in reply to get the peak values with perl
,in the array 1,2,3,4,2,3,5,6,3,2,4,1
i want to get the peak values [4,6,4]
Assuming the criteria is: "values where the values either side are lower", that's easy.
Iterate from 1 .. $#array -1; if $array[ $_ -1 ] < $array[ $_ ] and $array[ $_ +1 ] < $array[ $_ ] print $array[ $_ ];
i also wanna get [4,5,6,4]
By what criteria do you select the pair (5,6) for inclusion whilst excluding the pair (3,4)?
|
|---|