in reply to Re: Garbage-collecting with closures
in thread Garbage-collecting with closures
The output seemed to be correct ...use strict; my $foo = 0; sub leaky { my $closure = sub { $foo++ }; return $closure; } my $x = leaky(); my $y = leaky(); print $y->(), $/ while $x->() < 10; ---- 1 3 5 7 9
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re2: Garbage-collecting with closures
by perrin (Chancellor) on Feb 19, 2003 at 23:37 UTC |