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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":