in reply to golf: shortest way to parse a pipe delimited file
This will do it, but I don't know how you would score it for comparison.
perl -anF"\|" -le"$f{shift@F}=[@F[1..$#F]]" pipe.txt
And you need this to prove it worked
P:\test>perl -MData::Dumper -anF"\|" -le"$f{shift@F}=[@F[1..$#F]]}{pri +nt Dumper \%f" pipe.txt $VAR1 = { '6' => [ 'foo', 'bar', 'bax' ], '3' => [ 'foo', 'bar', 'bax' ], '7' => [ 'foo', 'bar', 'bax' ], '9' => [ 'foo', 'bar', 'bax' ], '2' => [ 'foo', 'bar', 'bax' ], '8' => [ 'foo', 'bar', 'bax' ], '1' => [ 'foo', 'bar', 'bax' ], '4' => [ 'foo', 'bar', 'bax' ], '10' => [ 'foo', 'bar', 'bax' ], '5' => [ 'foo', 'bar', 'bax' ] };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: golf: shortest way to parse a pipe delimited file
by bageler (Hermit) on Nov 10, 2005 at 19:49 UTC | |
by BrowserUk (Patriarch) on Nov 10, 2005 at 20:16 UTC | |
by bageler (Hermit) on Nov 12, 2005 at 22:22 UTC | |
|
Re^2: golf: shortest way to parse a pipe delimited file
by sauoq (Abbot) on Nov 12, 2005 at 23:26 UTC | |
by BrowserUk (Patriarch) on Nov 12, 2005 at 23:40 UTC | |
by sauoq (Abbot) on Nov 12, 2005 at 23:58 UTC |