in reply to Re^2: Catching closures
in thread Catching closures
use strict; use warnings; sub funcs { my $a = 0; return ( sub { $a++ }, sub { $a } ); } my ( $f11, $f12 ) = funcs(); my ( $f21, $f22 ) = funcs(); print join( " ", $f11->(), $f12->(), $f22->() ), "\n"; #prints "0 1 0"
My point was that if someone wants to change state, he should understand what he's doing. And he probably does. Preventing that is rude.
The OP may be in some special situation, however. That's what my question was about.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Catching closures
by hipowls (Curate) on Mar 06, 2008 at 10:09 UTC |