in reply to sort index (head cold)
If you mean to pull out the indexes for the first set of "sorted" data (e.g. the first set of elements where the next is greater than the previous), something like this should work:
@a = (9, 8, 7, 4, 5, 6, 3, 2, 1); # index 3..5 is wanted @index = grep { $a[$_+1] > $a[$_] .. $a[$_+1] <= $a[$_] } 0..$#a-1; print "found index @index = @a[@index]\n";
|
|---|