On Thu, 2002-04-04 at 11:09, Luke Palmer wrote: > On Thu, 4 Apr 2002, James Ryley wrote:
> 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.