in reply to Re: Lost anonymous subs
in thread Lost anonymous subs
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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Lost anonymous subs
by diotalevi (Canon) on Dec 09, 2004 at 17:21 UTC | |
by kappa (Chaplain) on Dec 10, 2004 at 12:07 UTC | |
by diotalevi (Canon) on Dec 10, 2004 at 15:02 UTC | |
by kappa (Chaplain) on Dec 10, 2004 at 15:27 UTC | |
by diotalevi (Canon) on Dec 10, 2004 at 16:20 UTC | |
| |
|
Re^3: Lost anonymous subs
by ysth (Canon) on Dec 10, 2004 at 11:50 UTC |