List::Util::reduce() is very useful for this:
use List::Util qw[ shuffle reduce ];; my %hash; @hash{ 'a'..'z' } = shuffle 1 .. 26;; my $maxKey = reduce{ $hash{ $a } > $hash{ $b } ? $a : $b } keys %hash; +; print "$maxKey : ", $hash{ $maxKey };; x : 26
In reply to Re: max "value " of an hash
by BrowserUk
in thread max "value " of an hash
by perl_user123
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |