in reply to Sorting hashes with new value detection

If you wanted to do it using map you could do this:
my %hash; map { push( @{ $hash{ $values{$_} } }, $_ ) } keys %values;
which if you were golfing would save you a few characters on Roy Johnson's probably easier to read version:
while(my($k,$v)=each%values){push@{$hash{$v}},$k;}
which becomes:
map{push(@{$hash{$values{$_}}},$_)}keys%values;
and then access the result with:
for my $key (reverse sort keys %hash) { print "Level $key:\n", join(", ", @{$hash{$key}}), "\n\n"; }