in reply to Re: golf: shortest way to parse a pipe delimited file
in thread golf: shortest way to parse a pipe delimited file

Your first solution will misbehave if you run across a line like:
foo||bar
Your second solution can be shortened by 3 characters:
sub func { #23456789_123456789_123456789_12345678 chomp(@_=split'\|',pop);$p{+shift}=\@_ }
and one more if you're willing to replace chomp with chop.

Replies are listed 'Best First'.
Re^3: golf: shortest way to parse a pipe delimited file
by bageler (Hermit) on Nov 10, 2005 at 19:38 UTC
    this fails by giving an empty hash entry.
    $VAR1 = { '' => [], 'aaa' => [ 'bbb', 'ccc' ], 'foo' => [ 'bar', 'baz' ] };
      It doesn't fail for me with Perl 5.8.7.

      My best guess is that your input had a blank line in it at the start or the end. That blank line would (legitimately from the spec) result in the output that you saw.