> > How 'bout:
> >
> > $foo = 'def';
> > $bar = 'ghi';
> > $y = 'abc$foo$bar';
> > $z = eval qq{"$y"};
> >
> > Of course, for security and correctness reasons, you'd probably want
to:
> >
> > $y =~ s/\\/\\\\/g;
> > $y =~ s/"!/\\"/g;
> 
> Why would "\\t" not double-interpolate to a tab? Also, why would "\\"
> not double interpolate to a syntax error?
> 
> Given $(...), you might as well give up on correctness and security.
It
> seems like you really just want to have a limited version of eval
called
> interpolate, e.g.:
> 
>       $z = interpolate interpolate $y;
> 
> Then you have ultimate control. Of course, you have to check $@ (er,
$!)
> just like you do with eval.

Thanks for the excellent feedback from both of you.  Using eval does
have its drawbacks, as Aaron points out, but along with some
substitutions like Luke suggested, it is fine for my purposes.

Reply via email to