Simon Cozens wrote:

> sub interpolate {eval "\"@_\""}
>
> Never say "there is no way". There's *always* a way, and 99% of the time it
> doesn't need to go in core.

Yes.  Well, actually if you carefully read the thread about RFC 111 in which I got
the inspired flash that interpolation of variables might be useful, you'll see that
I knew about this way, and even suggested it.  In fact, I meant to put it in the
IMPLEMENTATION section of the RFC, but sent it too soon, and already have version 2
ready with that change, but was waiting to learn the number, and read the initial
comments to see if any other changes should be made.

This fails if @_ contains ", or the other delimiter if using qq.  Using \000 as a
delimiter is _pretty_ safe, but perl strings are allowed to contain it, and I have
scripts that have strings containing \000 characters.  So really even this is not a
complete solution, if you have a string that happens to contain all the possible
characters, such that no delimiter is possible.

OK, you could rescan and quote the delimiter... that's harder... almost might as
well implement your own quoting.

The other problem with this being a sub is that it wouldn't handle lexical
variables correctly, not knowing their names in the sub.

> --
> "Even if you're on the right track, you'll get run over if you just sit there."
> -- Will Rogers

Thanks for bringing this quote to my attention.  I may use it some.
--
Glenn
=====
There  are two kinds of people, those
who finish  what they start,  and  so
on...                 -- Robert Byrne



____________NetZero Free Internet Access and Email_________
Download Now     http://www.netzero.net/download/index.html
Request a CDROM  1-800-333-3633
___________________________________________________________

Reply via email to