my $max = (sort {$b <=> $a} keys %hash)[1];