in reply to State information for flipflop .. operator.
A quick test:
shows that multiple closures made from the same anonymous sub have different states. The &$y call has no effect on &$z's return value.$ perl -we'sub makeit { my $i; sub { ++$i; ($i%6==1)..($i%6==3) } } $z = makeit(); $y = makeit(); print grep {&$y; &$z} "a".."r"' abcghimno
It is likely to be possible to save (and with 5.8.1, restore) a flipflop's state using the B module.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: State information for flipflop .. operator.
by rinceWind (Monsignor) on Aug 16, 2004 at 15:58 UTC |