in reply to Regexp vars localization in blocks

I feel that I should know the answer to this, but I haven't a clue. I note that the scope in the foreach and while blocks is being unwound on each iteration:

our $x = 1; for (1, 0) { print "$x "; local $x = 2 if $_; print "$x "; } print "$x\n"; __END__ 1 2 1 1 1

I would suggest reporting it to the Perl project on github as an unexpected inconsistency and possible bug.