in reply to Re: What's the idiom for finding and removing the found @ARRAY element?
in thread What's the idiom for finding and removing the found @ARRAY element?

If you absolutely must modify an array in place with deletes, then you could do it this way:

for my $i ( reverse 0 .. $#a ) { splice( @a, $i, 1 ) if should_delete; }

You could but I wouldn't recommend it. Count down in a while loop.

Normally when I feel the need to alter an array in place, I won't want to create the lists  0 through  $#a and  $#a through  0.

The new foreach optimization of the range operator would be much more useful if the behaviour of $#a .. 0 had not changed. Oh well.