in reply to Comma Delimited File
What this does isuse strict; $_ = <DATA>; my $cnt = tr/,/,/ + 1; my @fields; push @fields, split /,/ while <DATA>; chomp(@fields); my %data; push @{$data{$_ % $cnt}}, $fields[$_] for 0..@fields-1; my @row; for (keys %data) { @row = sort @{$data{$_}}; print "$_ - @row\n"; } __END__ num1,num2,num3 123,345,578 345,349,340 12,348,023 534,90283,230 239,394,283
broquaint
Update: it's probably best to go with davorg's approach if you actually want to implement this, but I'll leave this here in the spirit of TMTOWTDI.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Comma Delimited File
by davorg (Chancellor) on Nov 07, 2001 at 21:36 UTC | |
|
Re: Comma Delimited File
by mikeB (Friar) on Nov 07, 2001 at 21:19 UTC | |
by broquaint (Abbot) on Nov 07, 2001 at 23:16 UTC |