in reply to CSV Columns: Friend or foe?

You could do it with an array instead of a hash. You'd have to benchmark it to see whether that makes a noticeable difference. Untested code follows.

chomp(my $line = <IN>); my @head = split(',', $line); my @cols; my $row = 0; while($line = <IN>) { chomp($line); my @row = split',', $line; $cols[$_][$row] = $row[$_] for 0..$#row; $row++; }

And if I were really prematurely optimizing this, I'd use 1-@row instead of $#row!

Replies are listed 'Best First'.
Re^2: CSV Columns: Friend or foe?
by Anonymous Monk on Dec 01, 2010 at 13:19 UTC
    Hi Sir, In the code what does this IN stands for ?