Yup, diddling what you're iterating over with foreach is asking for trouble. Quoth perldoc perlsyn:
If any part of LIST is an array, "foreach" will get very confused if you add or remove elements within the loop body, for example with "splice". So don't do that.
In reply to Re: Regexp works with some elements and doesn't with others
by Fletch
in thread Regexp works with some elements and doesn't with others
by lampros21_7
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |