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