The 'e' is required to treat the replacement as Perl code and not a literal string. You don't want the \b's in the replacement because the replacement isn't a regex - it's normally a literal string. You can chain 'e' so that the first evaluation would produce Perl code that would, itself, be evaluated.
This is all explained in the relevant page at http://perldoc.perl.org. (Scroll down a bit to find the s/// section.)
In reply to Re: Can I Use Variables In A Regex?
by dragonchild
in thread Can I Use Variables In A Regex?
by Khatri
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |