my $min = 1e10; for my $key (keys %h) { $min = $key if $key < $min; } # now, $min is the smallest key. The associated value is simply $h{$min}