Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Getting columns from cvs file in perl

by Joost (Canon)
on Apr 24, 2007 at 13:38 UTC ( #611734=note: print w/replies, xml ) Need Help??

in reply to Getting columns from csv file in perl

That doesn't look like a CVS file. It looks like a CSV file.

I recommend Text::xSV or Text::CSV_XS.

  • Comment on Re: Getting columns from cvs file in perl

Replies are listed 'Best First'.
Re^2: Getting columns from csv file in perl
by pnsreee (Initiate) on Apr 24, 2007 at 13:57 UTC
    Hi Joost, It is csv file. I want expresion with out using Text::xSV or Text::CSV_XS.

      Just don't come back whinging when you have data with embedded commas or newlines and the quick hack no longer works. You may get away with it this time, but n months down the road someone (possibly even yourself) will be swearing under their breath at you as they clean up the mess.

        my @data = map { [split /,/] } <>;

        You might want a chomp in there to avoid leaving the line terminator in the last field.

        my @data = map { chomp; [split /,/] } <>;

        I second your *sigh* by the way.



Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://611734]
and one hand claps...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2016-12-04 22:47 GMT
Find Nodes?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:

    Results (70 votes). Check out past polls.