my $highest; for (@array) { # or keys %hash $highest = $_ if $_ > $highest; }