in reply to Printing a Hash Slice problem
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Printing a Hash Slice problem
by dorward (Curate) on Feb 28, 2005 at 17:32 UTC |