That is not the problem. The problem is to get the RHS of the regex to interpolate the value captured in $1 into the replacement string and do the substitution.
On first impressions the logic for wanting to do this appears dubious, especially in the simple case given. It might just make sense if you wanted to use $1, $2, etc simultaneously. I can remember wanting to do this some time back for reasons that now totally elude me. This was followed by the realisation that there are many ways to tacke any given problem and this way has dubious value IMHO. There are two basic solutions I know of - the q("$1blah") method with /ee and the sub{"$1blah"} method - both noted above.
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: Re: $1 in variable regex replacement string
by tachyon
in thread $1 in variable regex replacement string
by dvergin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |