Re: perlfaq4: expanding variables in strings

[email protected] (Brian McCauley)
Newsgroups perl.perlfaq.workers
Message-ID <[email protected]>
Robert Spier <[email protected]> writes:

> > See recent discussions in comp.lang.perl.*.  Brian d Foy indicated
> > that he felt this FAQ was getting too involved and that if the true
> > answer was to be included then other stuff must be lost. Global
> 
> I don't have the bandwidth for clpX.
> 
> It's my opinion that you're still snipping too much potentially useful
> things out.

"Things"?  Plural?  I've only cut one thing (apart from misleading or
content-free narrative) is the symref solution.  This solution is of
negledgible potential use - it old FAQ more-or-less admits this.

>  Maybe it needs to be split into two entries.

I can see this, maybe.  

Question 1:

  How can I apply Perl interpolation to a string?

  [ all about chop($text = eval"<<END\n$text\nEND\n") ]

  See also ``How do I make a text templating system in Perl?''

Question 2:

  How do I make a text template in Perl?

  [ all the stuff from the old FAQ plus mention of sprintf, format and
  the Templating modules on CPAN ]

  See also ``How can I apply Perl interpolation to a string?''
  
> But anyway, I'd like someone else to chime in.

I must admit I had not expected a debate - I thought it was
overwhelmingly accepted that this FAQ was wrong and needed to be fixed
so that it actually answered the question that was frequently asked.

I can't believe that anyone who has thought about it would disagree
that the answer to the question that is frequently asked is chop(
$text = eval "<<END\n$text\nEND\n").

Can't we just commit and move on?

If you think we need to split this so that we can have a more extensive
FAQ entry about text templates in general then that should be
addressed as a separate issue.

BTW: Where can I find an archive of [email protected]?

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.