> 
> Seems this has already been proposed by Nikola!! I like this 
> approach as it's in the spirit of Perl and a one liner :)!!
> 
> > Why not use sort on the array and get the last element 
> which would be the highest?? 
> 
> > my @sorted = sort @list;
> > my @sorted = sort 
> > my $max = $sorted[$#sorted];
> 
> > Wouldn't this work ? I a not sure about the speed though!!

Doesn't work because of how it sorts, go ahead and try it:
but this will work:
@sorted = sort { $a <=> $b } @list;
my $max = $sorted[$#sorted];


>  
> 
> 
> >Here is a routing that i use:
> --
> > @nums = (5,6,3,7,2,9,12,46);
> >$rv = min(\@nums);
> > print "$rv\n";
> 
> >ub min {
> >     my($num) = @_;
> >     my ($max) = shift @$num;
> >     foreach $i (@$num) {
> >             $max = $i if $max < $i; 
> >     }
> >     return($max);
> >}
> 
> > -----Original Message-----
> > From: Konrad Foerstner [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, July 16, 2002 12:38 PM
> > To: [EMAIL PROTECTED]
> > Subject: find biggest number
> > 
> > 
> > Hi,
> > 
> > Im looking for a method to exact the
> > biggest element (number) out of array. 
> > Does anyone know a function for that?
> > 
> > cu
> > 
> > Konrad
> > 
> > -- 
> 
> -- 
> 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