http://www.perlmonks.org?node_id=1047003


in reply to Re: Removing certain lines from array
in thread Removing certain lines from array

You should turn warnings on and rerun this script.

Iterating over the array in reverse will avoid the problem of the loop indices needing adjustment after an element is deleted.

Update: You changed the script while I was replying. Your description doesn't match now, although I suspect it will in a moment. ;o)