Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Double Interpolation of a String

by 5mi11er (Deacon)
on Feb 01, 2007 at 22:26 UTC ( #597847=note: print w/ replies, xml ) Need Help??


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


Comment on Re: Double Interpolation of a String
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://597847]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2015-07-02 03:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (27 votes), past polls