On 4 Apr 2002, Aaron Sherman wrote:
> 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.
Uhm, I disagree. I think you really get ultimate control _without_
interpolate. Some people might want to make \\t interpolate to tab, and
some would not. The syntax is simple enough for simple s///'s to take care
of it. And you could say
die "Can't interpolate expressions" if /$\(/;
And things like that. I think its fine.