On Tue, 23 Jul 2019 08:00:01 -0700, choroba@matfyz.cz wrote: > As stated in the Subject: using "my" in the "until" statement modifier > resets > the lexical of the same name from outer scope. > > See also https://www.perlmonks.org/?node_id=11103184 and especially > the reply https://www.perlmonks.org/?node_id=11103204 for more > details. > > #!/usr/bin/perl > use warnings; > use strict; > > warn $]; > > our $our = 1; > warn 'never' until $our = 6; > warn "<< $our >>"; # 6 > > my $mine = 1; > warn 'never' until $mine = 6; > warn "<< $mine >>"; # 6 > > our $nil = 1; > warn 'never' until my $nil = 6; # my ! > warn "<< $nil >>"; # undef > > my $null = 1; > warn 'never' until my $null = 6; # my ! > warn "<< $null >>"; # undef > > When using "if" instead of "until", the output is always "6". > > Thanks to LanX who is normally to busy/lazy to report perlbugs newLOOPOP() calls op_scope() to wrap the statement in an enter/leave pair, and since padsv does a save_clearsv() for the my variable, it's cleared by the leave. Tony --- via perlbug: queue: perl5 status: new https://rt.perl.org/Ticket/Display.html?id=134303