in reply to Re: A Real Closure
in thread Unusual Closure Behaviour
Err, the warning is due to defining a function (that ends up acting as a closure, due to its use of lexicals defined in an upper scope) inside a function. But if you write:
japhy -- Perl and Regex Hacker
Then $x is private to &count, and because &count refers to a lexical that "should" have "gone away", it is a closure. At least, that is what I have understood from Randal.{ my $x; sub count { ++$x } }
japhy -- Perl and Regex Hacker
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: A Real Closure
by John M. Dlugosz (Monsignor) on Jul 12, 2001 at 18:50 UTC | |
by tilly (Archbishop) on Jul 14, 2001 at 22:01 UTC |
In Section
Seekers of Perl Wisdom