in reply to Re: Getting columns from cvs file in perl
in thread Getting columns from csv file in perl

This node falls below the community's minimum standard of quality and will not be displayed.
  • Comment on Re^2: Getting columns from csv file in perl

Replies are listed 'Best First'.
Re^3: Getting columns from csv file in perl
by Fletch (Bishop) on Apr 24, 2007 at 14:47 UTC

    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.

Re^3: Getting columns from csv file in perl
by Joost (Canon) on Apr 24, 2007 at 14:17 UTC
      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.

      Cheers,

      JohnGG