develooper Front page | perl.perl5.porters | Postings from March 2013

Re: Infinite loop in for (@a) { push @a, $_ }

Thread Previous | Thread Next
March 19, 2013 12:02
Re: Infinite loop in for (@a) { push @a, $_ }
Message ID:
demerphq wrote:
>Seems to me we just* have to remember the size of the array when we
>start the for() loop and only iterate to that size.

That only works if the only array modification in the loop is to add
new elements on the end.  Fails if the array is shortened, or spliced,
or if element aliasing changes.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About