http://qs1969.pair.com?node_id=1026444


in reply to highest value in hash

Should performance be not your highest goal, you can sort the keys of the hash by their values in descending order and pick the first one:

use warnings; use strict; my %hash= ( '1', '8', '2', '6', '3','3' ,'4','7'); my @keys = sort { $hash{$b} <=> $hash{$a} } keys %hash; print "Key with highest value is $keys[0].\n";