in reply to Interpolating variables in a string

my $aha = 'upon'; my $oho = 'a'; my $text = 'once $aha $oho time'; $text =~ s/\$(\w+)/${$1}/g; print $text;
If you have variable names containing something other than just \w, you'll have to expand the regex a bit, but there's the mechanism you need. ${'varnam'} is the same as $varname.