in reply to (Golf) List to Hash

It's not exactly the best golf (since I'm not much of a golfer-- I prefer readable code that passes strict), but here's the basic idea in the most concise "idiomatic" Perl I can write. You throw a wrench into the works with the list that translates to 'foo => zoo moo too bar => car far bar => zar tar qux => mux'.

#!/usr/bin/perl -w use strict; use Data::Dumper; my $h = f(qw[ foo => zoo moo too bar => car far bar => zar tar qux => mux ]); print Dumper $h; sub f { my( %hash, $y ); my $key = my $x = shift; while($y = shift){ if( $y eq '=>' ){ pop( @{$hash{$key}}); $key= $x; $y = shift; } push( @{$hash{$key}}, $y ); $x = $y; } return \%hash; }
condensed I get to:
sub f { my(%h,$y);my$k=my$x=shift;while($y=shift){if($y eq'=>'){pop@{$h{$k}};$ +k=$x;$y=shift;}push(@{$h{$k}},$y);$x=$y;}return\%h; }
for a score of 118.