http://www.perlmonks.org?node_id=210474


in reply to eval using hash values

It may be a bit of an overkill, but assuming you are trying to have:
$text = 'my $foo has gone completely $bar'; %hash = (foo => 'dog', bar => 'crazy'); $final_text = unknown_method($text); #$final_text is now 'my dog has gone completely crazy'
I think Text::Template will do exactly what you want. If that's not what you want, please clarify.