David Samuelsson wrote at Fri, 30 Aug 2002 10:22:56 +0200: > > i get an array conataining a lot off numbers like this: > > 567 > 551 > 540 > 540 > 540 > 533 > 531 > 526 > 493 > 476 > 468 > 429 > 421 > 520 > > how do i find the lowest or the higest number in this series?
There's also a module doing such a job for you: use List::Util qw/min max/; my $min = min @array; my $max = max @array; (Of course, that's not the quickest solution, as it is an 2 * O(n) algorithm, and perhaps also a sort is quicker for little lists, as it is implemented directly in Perl - But it's a very simple and readable solution). Greetings, Janek -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]