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

The behavior you describe would be possible if you were escaping the $. Is that really your code, or do you actually have:
s/XXYY/\$foo/;