User Profile

Collapse

Profile Sidebar

Collapse
NOTSomebody
NOTSomebody
Last Activity: Aug 26 '08, 02:09 AM
Joined: Jul 30 '08
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • How to substitute the space for field of csv format?

    Currently my data is this in excel but as a csv format:

    "a", "as " sd", "123"
    "b","asd"," 234"
    "c","as d","345"

    I wanted to make the output this:
    a,as " sd,123
    b,asd,234
    c,as d,345

    the code i tried is this

    Code:
    use strict;
    use Text::CSV_XS;
    ...
    See more | Go to post

  • NOTSomebody
    started a topic Error message during runtime
    in Perl

    Error message during runtime

    When I tried to run my application, it says

    Global symbol "%files" requires explicit package name at c:\codes\testin g2.pl line 9.

    Can anybody tell me what does this means and how to I solve this? I googled it but I still dont get it.
    See more | Go to post

  • NOTSomebody
    started a topic Please help me understand this code...
    in Perl

    Please help me understand this code...

    I am new to Perl and I have these codes but I am not quite understand the regular expression here. Can any1 please explain to me?

    Code:
    $csv = "test.csv";
    open(DAT, $csv) || die("Cannot Open File");
    
    while (<DAT>) {
        my @new  = ();
    
        push(@new, $+) while $_ =~ m{          #what does these means
            "([^\"\\]*(?:\\.[^\"\\]*)*)",?
    ...
    See more | Go to post

  • okay...i will try... thanks alot... sry coz im quite new to this forum so i dunno hw 2 use the code tag etc. sry, i will try 2 use all that in future. thanks alot.
    See more | Go to post

    Leave a comment:


  • How to keep double qoute when i want to generate SQL statements?

    Hi all, please help a Perl newbie here...

    Supposed my data (CSV format) is:
    Code:
    a,123,123
    b,234,234
    c,345,345
    Supposed my code is:

    Code:
    $csv = "test.csv";
    open(DAT, $csv) || die("Cannot Open File");
    
    while (<DAT>) {
        my @new  = ();
    
        push(@new,
    ...
    See more | Go to post
    Last edited by eWish; Aug 4 '08, 07:44 AM. Reason: Please use [code][/code] tags

    Leave a comment:


  • Thank you Kevin. I finally able to finish my application. Thanks a million!!!
    See more | Go to post

    Leave a comment:


  • NOTSomebody
    started a topic How to generate SQL statements using Perl?
    in Perl

    How to generate SQL statements using Perl?

    Hi people,

    Suppose, my data is as below: (CSV format)

    Code:
       'asd,asd,asd','123','123'
       'asd','456','123'
    Suppose my code is this:

    Code:
    $csv = "test.csv";
    open(DAT, $csv) || die("Cannot Open File");
    
    while (<DAT>) {
    
        my @new  = ();
    
        push(@new, $+) while $_ =~ m{
            "([^\"\\]*(?:\\.[^\"\\]*)*)",?
    ...
    See more | Go to post
    Last edited by eWish; Aug 4 '08, 03:12 AM. Reason: Fixed [code][/code] tags

  • I mean, from i tried your solution for me for the previous post. And now I am able to retrieve the fields. Now, i want to extract 1 field from the csv and assign the data to say $name, $contact_no, $address. How do I assign?
    See more | Go to post

    Leave a comment:


  • NOTSomebody
    started a topic How to assign data after getting from CSV?
    in Perl

    How to assign data after getting from CSV?

    I faced a problem using Perl. I get the data from CSV using
    Code:
    $csv = "test.csv";
    open(DAT, $csv) || die("Cannot Open File");
    
    while (<DAT>) {
    
        my @new  = ();
    
        push(@new, $+) while $_ =~ m{
            "([^\"\\]*(?:\\.[^\"\\]*)*)",?
    
               |  ([^,]+),?
    
               | ,
    		}gx;
    ...
    See more | Go to post
    Last edited by numberwhun; Aug 1 '08, 12:28 PM. Reason: Please use code tags

  • Just for information, may i know are you from Singapore?
    See more | Go to post

    Leave a comment:


  • Thanks alot kevin.

    But, if i want to use the module, do you mind if you actually show me an example? thanks alot in advance... :p
    See more | Go to post

    Leave a comment:


  • Thanks for the prompt reply.

    My data was input through excel then save under csv. In the excel, i gt few fields... Lets say is "abc,def,ghi",1 23,asd

    I tried this

    Code:
    my $csv = "test.csv";
    my @data = read_file($csv);
    
    foreach($a=1; $a<@data.""; $a++)
    {
    	print @data[$a];
    }
    
    sub read_file{
    	open(F, $_[0]) || die("Can't
    ...
    See more | Go to post
    Last edited by eWish; Jul 30 '08, 02:04 PM. Reason: Please use code tags

    Leave a comment:


  • NOTSomebody
    started a topic How to read csv file that has ',' within data?
    in Perl

    How to read csv file that has ',' within data?

    I am new to Perl programming and I faced a problem now.

    I need to process a csv file and as for now, if the string is like '123' or 'asd', I could do it without any problem because it is commas inbetween data. But if I want to process like 'asd,asd,asd', I do not know how to read the whole string with the commas because as of now, I use split ',' to get data from different field of the csv. please help!!!
    See more | Go to post
No activity results to display
Show More
Working...