Help for this page

Select Code to Download


  1. or download this
    my ($min, $max) = (1e10, -1e10);
    for my $value (keys %hash) {
    ...
        $max = $value if $value > $max;
    }
    # $now $min has the smallest key and $max the highest one
    
  2. or download this
    my ($min, $max) = (sort {$a<=>$b} keys %hash)[0,-1];