Perl: the Markov chain saw | |
PerlMonks |
Re^2: qr// and user provided regex patterns...by misterMatt (Novice) |
on Jul 31, 2009 at 19:58 UTC ( [id://784983]=note: print w/replies, xml ) | Need Help?? |
Using the eval works great for matches : $pattern = eval "qr$pattern" or die $@;
But of course, when I do a 'substitution pattern' s///, it fails because it looks like eval "qrs/stuff/morestuff/.
So I tried adding a bang, to wrap around the interpolated variable in the original : $pattern = eval "qr!$pattern!" or die $@;
But now my patterns fail to match anything. Example:
In Section
Seekers of Perl Wisdom
|
|