in reply to Re^2: foreach argument modification inside loop, followed by return from loop
in thread foreach argument modification inside loop, followed by return from loop

Sorry, It was much too long ago for my memory. I have not had access to a newsgroup server for some time. I do not even rember my old username. It was written by a very active user named PerlGurl (not sure of spelling). I reasonably certain that the application was randomizing an array. Notes that I had did not survive a hard drive failure.
Bill
  • Comment on Re^3: foreach argument modification inside loop, followed by return from loop

Replies are listed 'Best First'.
Re^4: foreach argument modification inside loop, followed by return from loop
by vsespb (Chaplain) on Jul 12, 2013 at 09:00 UTC
    I found something.

    https://groups.google.com/forum/#!searchin/comp.lang.perl.misc/randomizing$20/comp.lang.perl.misc/D8Znz7CbCyg/ZXcyK3OTUEIJ

    PerlGuru + something about randomizing array + foreach+splice+last

    '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.' > > Your testing seems to prove that this is a special case, certainly a > very useful one. > Please explain what makes it special. The 'last' makes it special. By exiting the loop there is no opportunity for confusion.
    But I did not find see "Anyway, don't do it, even with "last"" advices :(