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


in reply to Double Interpolation of a String

Having just needed something along these lines, and after reading through the Dreaming of Post Interpolation thread, I think I've settled on using something like this:
@lines = <<TEXT_INFO; Dear \$person, I know that this text is \$adjective. But I wish it could be... This is a test of imbedded variables I want to set \\\$variable later, and then have it interepreted when + printed variable was set to \$variable TEXT_INFO $variable = 5; my $person = 'Mom'; my $adjective = 'not interpolated'; foreach $line (@lines) { print eval "qq{$line}"; }
-Scott