Hash key at the max value

From BioPerl
Jump to: navigation, search
(sort {$h{$b} <=> $h{$a} keys %h)[0]

or

use List::Util;
$h{ max values %h };

All keys having max value:

my $max = [sort {$b<=>$a} values %h]->[0];
map { ($h{$_} == $max) ? $_ : () } keys %h;

--MAJ

Personal tools
Namespaces
Variants
Actions
Main Links
documentation
community
development
Toolbox