OK, so you want Perl to evaluate your string, not print it.
This is really covered in this FAQ for Perl: How to extend variables in text strings?
In short, you can use the following regular expression:
$string =~ s/(\$\w+)/$1/eeg;
CAUTION: Evaluating arbitrary strings from outside your scripts is a serious security risk. A good hacker can use this to execute arbitrary code on your server.
The answer to the question about Brian covers some of them.
source share