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