http://www.perlmonks.org?node_id=958207


in reply to Re: arrays: shifting in while loop
in thread arrays: shifting in while loop


Hmm, really? I always thought the while-loop EXPR was re-evaluated after each iteration:
my @a = (3, 4); while (do { say "yo"; @a }) { say "hi mom"; shift @a; # no explicit loop break out } say "bye mom"; __END__ yo hi mom yo hi mom yo bye mom