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

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

Thread Previous | Thread Next
From:
Eric Brine
Date:
March 20, 2013 06:38
Subject:
Re: Infinite loop in for (@a) { push @a, $_ }
Message ID:
CALJW-qGP+-irmF-AJFrrWeyUQGE221s8djryS0tZRGQsy_G0Cw@mail.gmail.com
On Tue, Mar 19, 2013 at 7:18 AM, demerphq <demerphq@gmail.com> wrote:

> This code is an infinite loop.
>
>    my @a = ("A".."D");
>    for (@a) {
>        say;
>        push @a, $_;
>    }
>

This comes up once in a while on PM and SO, but so much as to be a serious
problem. There's a convenient note in perlsyn that can be quoted to those
who encounter this problem.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About