A quick test ... shows that multiple closures made from the same anonymous sub have different statesNice one! That's what I wanted to hear.
It is likely to be possible to save (and with 5.8.1, restore) a flipflop's state using the B module.I don't think my internals knowledge is up to it. A CPAN module that did this would be nice though :).
In the mean time I am looking at preserving the input file position (with tell), together with the line counter and flipflop state using the return value from .. (in combination with $. when .. returns false). When I restore, I will need to short circuit the left operand if the flipflop state was on.
Anyone see any issues with this?
--
I'm Not Just Another Perl Hacker
In reply to Re^2: State information for flipflop .. operator.
by rinceWind
in thread State information for flipflop .. operator.
by rinceWind
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |