in reply to Sorting hashes with new value detection
which if you were golfing would save you a few characters on Roy Johnson's probably easier to read version:my %hash; map { push( @{ $hash{ $values{$_} } }, $_ ) } keys %values;
which becomes:while(my($k,$v)=each%values){push@{$hash{$v}},$k;}
and then access the result with:map{push(@{$hash{$values{$_}}},$_)}keys%values;
for my $key (reverse sort keys %hash) { print "Level $key:\n", join(", ", @{$hash{$key}}), "\n\n"; }
|
|---|