perlre explains why this is not permitted
Actually, perlre explains why (?{ code }) is not permitted which is quite a different thing.
The original code worked exactly as expected for me with the addition of a closing ')' on the if statement. (The match fails to increment $yep because the 'v' in $word doesn't match the vowel pattern).
Using variable interpolation in a regex is not a 'weird idea' at all. It can be an excellent way to improve the readability of your code.
In reply to Re: Re: Regular Expression Question
by grantm
in thread Regular Expression Question
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |