Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Evaluating $1 construct in literal replacement expression

by jwkrahn (Abbot)
on Feb 06, 2009 at 12:16 UTC ( [id://741886]=note: print w/replies, xml ) Need Help??


in reply to Evaluating $1 construct in literal replacement expression

How can I expand variables in text strings?
  • Comment on Re: Evaluating $1 construct in literal replacement expression

Replies are listed 'Best First'.
Re^2: Evaluating $1 construct in literal replacement expression
by Anonymous Monk on Feb 06, 2009 at 13:04 UTC
    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://741886]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-06-16 09:46 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.