in reply to Replacing text - problem with $1 variable

Seems to work here. Update: which is obvious since I'm using single quotes (non-interpolative) and you're using double-quotes (interpolative) so the $1 is being interpolated and the replace part of s/// actually looks like brianbob. Try something like this (i.e using single-quotes) and your code should work fine
perl -le '$_="brad123bill"; print; s/brad(.+?)bill/brian$1bob/; print' brad123bill brian123bob

HTH

_________
broquaint