[Please do not top-post -- it makes the conversation difficult to follow] On Jul 16, Konrad Foerstner said:
>On Tue, 16 Jul 2002 12:48:55 -0400 >"Shishir K. Singh" <[EMAIL PROTECTED]> wrote: > >> my @sorted = sort @list; >> my $max = $sort[$#sorted]; >> >> Wouldn't this work ? I a not sure about the speed though!! > >I think this is the easiest way! You need to sort it like so: sort { $a <=> $b } @list because plain sort() does ASCIIbetical, which puts "10" before "2". my ($max) = sort { $b <=> $a } @list; my $max = (sort { $a <=> $b } @list)[-1]; -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ ** Look for "Regular Expressions in Perl" published by Manning, in 2002 ** <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]