|Just another Perl shrine|
Re^2: improve ugly flow controlby Aristotle (Chancellor)
|on Sep 19, 2004 at 23:08 UTC||Need Help??|
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.