in reply to Re^3: golf: shortest way to parse a pipe delimited file
in thread golf: shortest way to parse a pipe delimited file
Not quite. That @v is global... you need [@v] because you won't be making a copy otherwise. Here's mine...
And yours...356,0 sauoq@fozzie:~$ perl -MData::Dumper -F'\|' -lane'($k,@v)=@F;$f{$ +k}=[@v]}{print Dumper \%f' foo|bar|baz qux|zab|oof $VAR1 = { 'qux' => [ 'zab', 'oof' ], 'foo' => [ 'bar', 'baz' ] };
357,0 sauoq@fozzie:~$ perl -MData::Dumper -F'\|' -lane'($k,@v)=@F;$f{$ +k}=\@v}{print Dumper \%f' foo|bar|baz qux|zab|oof $VAR1 = { 'qux' => [ 'zab', 'oof' ], 'foo' => $VAR1->{'qux'} };
-sauoq "My two cents aren't worth a dime.";
|
|---|