http://www.perlmonks.org?node_id=255685


in reply to Re: •Re: Re: Toggling between two values
in thread Toggling between two values

But I thought the "not stay shared" error is because the closure stuff is triggering on a named subroutine (usually inside another one). Is that not being closed on the first invocation, and subsequent invocations creating different lex vars?

And, on a completely different note, is this not a named closure?

my $coderef = do { my $counter = 0; sub { ++$counter }; }; *named_closure = $coderef;
That looks like I can call named_closure() to me, and it's a named closure.

Perhaps that's not what

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.