# New Ticket Created by  Stephane Payrard 
# Please include the string:  [perl #76068]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=76068 >


The bug is unrelated to the when construct but is related to the
handling of iterations.
The following lines has the same wrong behaviour as the previous one.

$_=1; for 11..12 -> $a {  if $_ == 1 { say "1 : $_"; $_=2  } else {
say "* : $_ "}  }

On Thu, Jun 24, 2010 at 10:33 PM, Stéphane Payrard <cognomi...@gmail.com> wrote:
> $_=1; for 11..12 -> $a {  when 1 { say "1 : $_"; $_=2 } when * { say
> "* : $_ " } }
>
> output is "1 : 1\n1 : 1" instead of the expected "1 : 1\n* : 2".
>
> The example is golfed and artificial. But there can be legitimate
> purposes iterating,
> modifying $_ in a branch and branching accordingly in the next iteration,
> with the loop iterator not stored in $_.
>
> --
> cognominal stef
>



-- 
cognominal stef

Reply via email to