Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^3: text has single and double quotes and anychar. how to assign this text?

by GotToBTru (Prior)
on Aug 20, 2015 at 13:55 UTC ( [id://1139311]=note: print w/replies, xml ) Need Help??


in reply to Re^2: text has single and double quotes and anychar. how to assign this text?
in thread text has single and double quotes and anychar. how to assign this text?

The interpolation will happen with the heredoc. Or, make up your own convention, something that will not appear in the text itself, and use s///.

$variable = 'there'; $string = <<END; Put my variable $variable and !here! END print $string . "\n"; $string =~ s/!here!/$variable/; print $string . "\n";

Output:

Put my variable there and !here! Put my variable there and there
Dum Spiro Spero

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-04-24 08:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found