in reply to s/this/$that/ Gives Variable Name, Not Contents of Variable

In addition to escaping the sigil in  $foo in double-quotish interpolation (e.g., "\$foo"), another way to get the effect you describe is to use single-quotes as the  s/// replacement delimiters:

>perl -wMstrict -le "my $foo = 'stuff'; my $str = 'xxx XXYY yyy'; $str =~ s'XXYY'$foo'; print qq{'$str'}; " 'xxx $foo yyy'

But of course single-quotes are not what you have in your OP. Are you fooling us — or yourself?