Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Treating a variable as a variable in a regular expression?

by InfiniteSilence (Curate)
on Jul 08, 2014 at 13:13 UTC ( [id://1092718]=note: print w/replies, xml ) Need Help??


in reply to Treating a variable as a variable in a regular expression?

perl -e 'sub foo {return qq|abracadabra|}; my $line = qq|hi there: sub +|; if($line=~s/sub/&foo/eg){print $line};'

Prints

hi there: abracadabra

Celebrate Intellectual Diversity

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2024-04-23 19:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found