our(@xlo, @xhi); my $t = my $t0 = $s[0] < 0; for my $x (0 .. @s - 1) { if ($t) { if ($s[$x] > 0.5) { $t = 0; push @xhi, $x; } } else { if ($s[$x] < -0.5) { $t = 1; push @xlo, $x; } } }