good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re^4: Elegant way to split into sequences of identical chars?by xdg (Monsignor) |
on Nov 30, 2005 at 21:14 UTC ( [id://513117]=note: print w/replies, xml ) | Need Help?? |
Great suggestion! I forgot about regex debug mode. It looks like whatever the code in (??{ code }) evaluates to is compiled into a regex (if it isn't one already) and then that regex is applied in a separate scope from the rest of the regex -- so it has its own match variables and so on. I wouldn't have expected that given the documentation in perlre. In the debug output, the telltales appear to be "Entering embedded..." and "restoring...", as seen below.
-xdg Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
In Section
Seekers of Perl Wisdom
|
|