rinceWind has asked for the wisdom of the Perl Monks concerning the following question:
But I am wondering if I can use this inside an iterator. I want it to retain its state information between successive calls to the iterator, as to which regexp it is looking for.while (<>) { if (/BEGIN/ .. /END/) { do some stuff } }
But, what's to stop someone from calling my code multiple times: multiple concurrent iterators. Will each flipflop keep track of its own state? What about if the multiple iterators are closures made from the same subroutine (hence same optree) - will this work?
Also, can I save and restore a given flipflop's state?
All help on this is most welcome.
--
I'm Not Just Another Perl Hacker
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: State information for flipflop .. operator.
by ysth (Canon) on Aug 16, 2004 at 15:01 UTC | |
by rinceWind (Monsignor) on Aug 16, 2004 at 15:58 UTC | |
|
Re: State information for flipflop .. operator.
by pbeckingham (Parson) on Aug 16, 2004 at 14:07 UTC | |
by Fiftyvolts (Novice) on Aug 16, 2004 at 19:53 UTC | |
by pbeckingham (Parson) on Aug 17, 2004 at 00:19 UTC | |
by Fiftyvolts (Novice) on Aug 17, 2004 at 13:47 UTC | |
by pbeckingham (Parson) on Aug 17, 2004 at 14:01 UTC |