in reply to Re: finding highest number
in thread finding highest number

No... that would be known as the slow way. This is an operation which should only have to traverse the array *once* where sort() has higher overhead (perhaps gjb has it right as O(n*log(n)) versus O(n)).

The better answer is to use something akin to what you posted. I'd want to check for undefined values as well. For an answer I just copied right from a toy mapping app I just coded up last night.

sub max { my $m; for (@_) { next unless defined; $m = $_, next unless defined $m; $m = $_, next if $m < $_; } $m }
__SIG__ use B; printf "You are here %08x\n", unpack "L!", unpack "P4", pack "L!", B::svref_2object(sub{})->OUTSIDE;