If you don't need to keep the key around, you can do this:
sub print_zHoA { my $HoA = shift; my @values = sort { $b->[0] <=> $a->[0] } values %{$HoA}; return $values[0]; }
Note, however, that while the code is short, it isn't as efficient as it could be since it puts all the hash slices in order rather then just finding the highest.
In reply to Re: Printing a Hash Slice problem
by dorward
in thread Printing a Hash Slice problem
by monkfan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |