Perl: the Markov chain saw | |
PerlMonks |
Re: Conditional regexby Anonymous Monk |
on Feb 17, 2013 at 18:35 UTC ( [id://1019185]=note: print w/replies, xml ) | Need Help?? |
But when I use the condition (?{pos() % 2 == 0}), I expect the same output, but I don't get it: Employ Basic debugging checklist or add use re 'debug'; to see what the regex engine is doing, and why your match fails then adjust your pos invocation Also, your code wont run as is -- come on :) use feature or whatever Also, I notice the x modifier doesn't work with a conditional pattern: It does , you just can't have space in condition, it has to be (?(?{, otherwise you couldn't distinguish between some constructs
In Section
Seekers of Perl Wisdom
|
|