Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Getting columns from cvs file in perl

by Fletch (Chancellor)
on Apr 24, 2007 at 13:37 UTC ( #611733=note: print w/ replies, xml ) Need Help??

in reply to Getting columns from csv file in perl

CPAN is your friend: Text::CSV_XS

Comment on Re: Getting columns from cvs file in perl
Re^2: Getting columns from cvs file in perl
by thezip (Vicar) on Apr 24, 2007 at 13:45 UTC

    You should also check the returned status when you parse a line:

    my $csv = Text::CSV_XS->new( { binary => 1 } ); my $status = $csv->parse($line); # parse a CSV string into fie +lds

    Occasionally, you'll encounter an invalid CSV line and you'll definitely want to handle it. If there are any embedded binary chars, you'll want to set the binary flag when you create the $csv object as I did above.

    Where do you want *them* to go today?

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2015-02-27 21:55 GMT
Find Nodes?
    Voting Booth?

    On my keyboard, Caps lock is:

    Results (456 votes), past polls