|
|
| Welcome to the Monastery | |
| PerlMonks |
Re^2: improve ugly flow controlby Aristotle (Chancellor) |
| on Sep 19, 2004 at 19:08 UTC ( [id://392254]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
In reply to the update: // does not match "anything". It is overloaded to reapply the last successfully matched pattern, in your case, /b/. You wouldn't notice that because all your test data past the successful match has a "b" in it… Changing that clearly reveals faulty logic: once the right side is true, and flipflop starts over on the left side again.
Now let's take a short trip to perlop:
You want a right side that does not succeed. Because once it succeeds, you start over on the left side again! Now a simple, correct match-always pattern is /^/ or /(?=)/, and a simple match-never pattern is /$^/ or /(?!)/. Indeed, using a match-never pattern:
Well, that sequence looks right. So that means you can say:
Makeshifts last the longest.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||