I have written almost exactly the same piece of code in the reply to diotalevi up there because did not spot your comment. Yes, that helped me to understand things.
I somehow got thinking that closures copy referenced lexicals when created. That was my error.
This is the case when copying really takes place:
my $Big = 'X' x 1000000; sub big { my $big = $Big; return sub { $big }; } my @crefs; push @crefs, big() for 1..10;
In reply to Re^2: Lost anonymous subs
by kappa
in thread Lost anonymous subs
by kappa
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |