in reply to Yet More fun With Array Indices

But you don't need to do this -- you can just use grep() and be done with it: @ok = grep !bad(), @orig;.

Also, it's considered dangerous to resize an array while looping over it (Perl-style), and difficult to resive an array while looping over it (index-style).

my $i = 0; while ($i < @array) { if (REMOVE) { splice @array, $i, 1 } else { ++$i } }
See? Only increment the index if the element's not being removed. This is why grep() is king. grep() is the True Way.

_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a job (NYC-area)
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;