in reply to Re: Finding the max()/min()
in thread Finding the max()/min()
Here's another recursive form:
sub max { my( $i, @l ) = @_; my $j = @l ? max( @l ) : $i; return $i > $j ? $i : $j; }
And for that matter, an iterative form:
sub max { $_[ 0 ] < $_[ -1 ] ? shift : pop while @_ > 1; return @_; }
Makeshifts last the longest.
In Section
Meditations