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";