in reply to RE: Re: Dreaming of Post Interpolation
in thread Dreaming of Post Interpolation

I forgot about the double-e substitution ( ie, s/(\$\w+)/$1/gee ). You can do that with lexicals.

No matter what, you end up doing some sort of substitution and/or eval. In the second example you want to re-evaluate $m=$n*2 whenever $n is reassigned, which isn't possible without creating more complex data structures. That's far different from interpolating variables into a string.

  • Comment on RE: RE: Re: Dreaming of Post Interpolation

Replies are listed 'Best First'.
RE: RE: RE: Re: Dreaming of Post Interpolation
by BBQ (Curate) on May 30, 2000 at 06:23 UTC
    I'm sorry, but I don't see why its different at all! As a matter of fact, in both cases, I have variables in a string. The contents of those variables should change later on, but not the string itself! I could agree that there are different approaches to each (basically because on deals with numbers and the other with text) but that doesn't mean that the presented wish changes.

    Had I defined $person and $adjective (with different values) before the string, then both would be practically the same examples.

    I don't think I've done a good job of explaining what I was thinking about, and I am starting to think that interpolation doesn't quite get the idea through. Referencing is closer as a term, but it has already been defined, and I don't beleive it comes close to what I wish perl would do either. Its fustrating to try and explain a concept that doesn't have any good examples (that I can provide at least).

    Nevertheless, thanks for the input!