"be consistent" | |
PerlMonks |
Re: Useful uses of redo?by glwtta (Hermit) |
on Aug 26, 2004 at 20:29 UTC ( [id://386161]=note: print w/replies, xml ) | Need Help?? |
I've used redo once in the last two years or so. Parsing a file with a rather involved format I had several subs to handle specific sections; these sections did not have a closing token of any kind, so the subs had to get a token to find out that they don't recognize it and that their section is over. Rather than futzing it so I can "unget" a token, it seemed easier to just return the current one and redo in the main loop. so:
Note that foo() doesn't see the line containing "Foo" nor did it need to in this case. Worked well, certainly don't know if that's doing the Right Thing.
In Section
Seekers of Perl Wisdom
|
|