Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

max function

Status
Not open for further replies.

clarissa1996

Technical User
Jan 31, 2002
78
0
0
CH
Does it exist a max() function in perl ?

Example:

$val = max(1,43,56);

Thanks for any help.

Michelangelo
 
hm, I don't know such function in Perl, but you simply can use map for this:
$max_value = 0;
map { $max_value < $_ && $max_value = $_ } @array;
or for cycle:
$max_value < $_ && $max_value = $_ for @array;
As you like it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top