in reply to Re: Re: Re: Re: walking an array and unshifting
in thread walking an array and unshifting
From perlsyn section "Foreach Loops":
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.
As merlyn and tadman imply below, the "right" way to do it depends on what else you are doing in that chunk of code, and on your future use of @list (both pre- and post-modification).
|
---|