good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
If you trust your input data (and I mean, really trust it), there is eval. Otherwise, whitelisting the variables is the sanest approach, and then basically doing s/\$(\w+)/$1/gee. Personally, I wouldn't allow a template to access arbitrary variables in the script and always decouple the template variable names from the inner workings of the program by using a hash, just like String::Interpolate does. In reply to Re: Invoke the Perl string interpolation engine on a string contained in a scalar variable.
by Corion
|
|