in reply to How to find the N largest values in an array?

The simplest way is just to sort the values numerically and get the top values:
my $n = 3; # top three my @highest = (sort { $b <=> $a } @num)[0 .. $n-1];

Replies are listed 'Best First'.
Re: Answer: Find largest ordered sequence in an array
by Anonymous Monk on Oct 03, 2001 at 23:18 UTC
    The problem is that the values are ordered by time and i need the 3 values to be "in a row" not just the 3 highest. the purpose of this is to "read" a peak in traffic. if i just pull out 3 highest it doesnt represent an average. thanks though, im looking to see if i can somehow use this.