There's More Than One Way To Do It(tm)

#1
$max = '';
foreach(@array){
  if($_ > $max){
    $max = $_;
  }
}

#2
@array = sort{$a <=> $b}@array;
$max = $array[-1];

-----Original Message-----
From: Peter Scott [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 16, 2002 10:17 AM
To: Konrad Foerstner; [EMAIL PROTECTED]
Subject: Re: find biggest number (new try :) )


At 06:42 PM 7/16/02 +0200, Konrad Foerstner wrote:

>sorry a small but important mistake
>
>Im looking for a method to extract the
>biggest element (number) out of array.
>Does anyone know a function for that?

use List::Util qw(max);
print max(@input);

--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com/


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to