Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Re-Interpolating a Scalar (a string)

by Joost (Canon)
on Jul 29, 2005 at 18:33 UTC ( [id://479504]=note: print w/replies, xml ) Need Help??


in reply to Re: Re-Interpolating a Scalar (a string)
in thread Re-Interpolating a Scalar (a string)

Unless you can guarantee that $color is always a string without meta characters, this is safer:
$raw = '$parsed = "fred has \Q$color\E eyes";'; eval $raw; print $parsed;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-03-29 07:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found