my $code; { my @arr = (9) x 1000_000; $code = sub { @arr }; } # here @arr got out of the scope but is not freed as # there's a ref from inside $code closure # which enables $code do things with the array when called undef $code; # only now that million of nines has gone away # it always existed in exactly one copy
In reply to Re^4: Lost anonymous subs
by kappa
in thread Lost anonymous subs
by kappa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |