Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: retriving info from a csv file in Tk

by lwicks (Friar)
on May 20, 2008 at 12:26 UTC ( [id://687597]=note: print w/replies, xml ) Need Help??


in reply to retriving info from a csv file in Tk

If it is the CSV parsing cauusing the problem the following might help:

require Text::CSV; my $csv = Text::CSV->new; open( FH, "<$fh" ) || die "Error: no open for $fh: $!"; foreach (<FH>) { if ( $csv->parse($_) ) { my @field = $csv->fields; my ( $Emp_ID, $Emp_Name ) = @field; push(@id, $Emp_ID); push(@names, $Emp_Name); } } # end foreach close(FH);
Assuming everything else in place the above code should read a file and give you two arrays, one of names one of IDs.

More esteemed monks can I am sure point out better ways of doing this, I'm sure. I justy wated to give an example of Text::CSV for you to look at.

Lance

Kia Kaha, Kia Toa, Kia Manawanui!
Be Strong, Be Brave, Be perservering!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://687597]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-04-24 08:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found