Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Evaluating $1 construct in literal replacement expression

by Anonymous Monk
on Feb 06, 2009 at 13:04 UTC ( [id://741889]=note: print w/replies, xml ) Need Help??


in reply to Re: Evaluating $1 construct in literal replacement expression
in thread Evaluating $1 construct in literal replacement expression

If you mean for example expand "abc $var xyz" so that the string $var is replaced by the value of $var then eval is the only way I know.

my $var = "123"; my $str = 'abc $var def'; my $temp = eval " \"$str;\" "; print "str2:$temp\n";

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-06-14 02:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.