The numeric variables ($1 etc.) are only set on the right hand side of a substitution. You need to use the corresponding backreference (e.g. \1) on the LHS of a s/// or in a m//. See perlretut and perlre, the former of which uses this exact problem as its example.
In reply to Re: Recognizing duplicates
by Fletch
in thread Recognizing duplicates
by b4swine
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |