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

Alright -- I am sorry to waste your time -- I have already figured it out!

$raw = '$parsed = "fred has $color eyes";'; eval $raw; print $parsed;


Sorry for the false alarm. :)

-Nich

Replies are listed 'Best First'.
Re^2: Re-Interpolating a Scalar (a string)
by friedo (Prior) on Jul 29, 2005 at 18:34 UTC
    While this will work fine, it's probably not a good idea. Especially if you don't know ahead of time what's going to be in $raw, any malicious code that gets put there will be evaled by your program. Further, string eval is quite slow from what I hear. Instead, I would highly reccomend using the hash lookup method provided by cmeyer above.
Re^2: Re-Interpolating a Scalar (a string)
by Joost (Canon) on Jul 29, 2005 at 18:33 UTC