in reply to Re^3: References for ano subs fixed at compile time? (nope)
in thread References for ano subs fixed at compile time?
The reason is that sub {2} reused the first ref and $b inhibits its release!
DB<161> ;{ my $b; for (1..3){ print sub {1} ; print $b= sub {2} if $ +_==1 } } CODE(0x86c5af0) CODE(0x86c5af0) CODE(0x86c5be0) CODE(0x86c5be0) DB<163> ;{ my $b; for (1..3){ print 0+sub {1} ; print 0+($b= sub {2} +) if $_==1 } } 141319216 141319216 141319552 141319552
Cheers Rolf
( addicted to the Perl Programming Language)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: References for ano subs fixed at compile time? (opnode)
by tye (Sage) on Jun 18, 2013 at 22:59 UTC | |
by LanX (Saint) on Jun 19, 2013 at 00:30 UTC |