Actually you have to use \1 in the left part, you can't use $1, but you can use either \1 or $1 in the right part.
$1... cannot be used in the left part because it would be expanded (the $1 from the previous regexp) and usage of \1 in the right part is mildly frowned upon, mostly for stylistic reasons, as it is close to the \nn or \nnn notation for octal characters (although as usual Perl will DWIM by interpreting \12 as $12 if there were more than 12 captured expressions and as the character \12 otherwise).
In reply to Re: Answer: More than one way to do it???
by mirod
in thread More than one way to do it???
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |