Modifying arrays (well, destructively modifiying them by changing their size) as you're iterating over them with for() is usually asking for trouble. Quoting from 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: Strangness with arrays
by Fletch
in thread Strangness with arrays
by BrowserUk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |