I've seen this question (or similar) asked many times on forums:
I have a variable in a file (text) and want to expand it. For example, I have this line in a text file:
Mary had a little $lamb
and I want to be able to expand $lamb but text files are treated as single-quoted strings and perl does not interpolate variables in single-quoted strings.