%h = do { my @temp = map { $_ => $h{$_} } sort { $a <=> $b } keys %h; @temp[0,1]; };