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 reply to Re^2: Finding the max()/min()
by Aristotle
in thread Finding the max()/min()
by dragonchild
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |