# New Ticket Created by  Sam S. 
# Please include the string:  [perl #129114]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=129114 >


This is how a state variable normally works:

    ➜  for ^2 { for ^2 { say (state $a)++ } }
    0
    1
    0
    1

But when it is declared inside a {} interpolation in a string, it misbehaves:

    ➜  for ^2 { for ^2 { say "{ (state $a)++ }" } }
    0
    1
    2
    3

It's as if the state variable attaches to the scope of the outer loop or 
mainline, instead of the inner loop like it should.

Reply via email to