in reply to Re: Deleting specific element in array in FOREACH loop
in thread Deleting specific element in array in FOREACH loop

Um, with your approach, if you don't actually shift every element off of @array, it'll be an infinite loop, I think. Maybe you meant something like:
my @keep = (); while (@array) { my $element = shift @array; # do stuff push @keep, $element unless ( $result eq 'foo' ); }
In any case, just doing  my @keep = grep { somefunc($_) } @array; (as suggested in earlier replies) feels easier and cleaner somehow.