Re: FAQ 4.36 How can I expand variables in text strings?



brian d foy <brian.d.foy@xxxxxxxxx> wrote:
In article <tqmim5xmel.ln2@xxxxxxxxxxxxxxx>, Eric Pozharski
<whynot@xxxxxxxxxxxxxx> wrote:
brian d foy <brian.d.foy@xxxxxxxxx> wrote:
In article <fc8cm5xnc2.ln2@xxxxxxxxxxxxxxx>, Eric Pozharski
<whynot@xxxxxxxxxxxxxx> wrote:
npc <npc@xxxxxxx> wrote:
On Fri, 01 Aug 2008 06:03:03 -0700, PerlFAQ Server wrote:
4.36: How can I expand variables in text strings?
I don't understand this faq entry. I'm probably
misunderstanding it.

Never mind. It's a ping-pong FAQ.
I'm not familiar with " ping-pong FAQ". Can you explain that?
That was paraphrased from C<ping-pong thread>. I admit, that this
particular entry doesn't go that far though.
And what does ping-pong thread mean? I still don't get what you are
pointing out about the answer that I might need to fix.

=item To: *

C<ping-pong whatever> means a contents where participants attempt to
find as many ways to achieve something using some tools. In context of
c.l.p.m the only tool used is Perl obviously. Is my understanding
right?

=item To: brian d foy

Please note, that B<both> my remarks was written in state of
misunderstanding what the question is. Decreasing signal/noise ratio is
the way my head works. Sorry. (As a gift, even year ago, I was much
more noisy.) Sometimes (as was my first remark) that happens again.

=back

[snip]

A-ha, now I see what I've missed. However than, please note that
that entry misses a bit of explanation why using C<qq()> doesn't
count as expansion.
Are we talking about the same answer? This one doesn't use qq().

Take a look at that part of answer (yes, it's taken out of context, but
that's what reader sees first):

my $foo = 'Fred';
my $bar = 'Barney';
$string = 'Say hello to $foo and $bar';

The question states C<How can I expand variables in text strings?>. The
unexpert reader (me?) doesn't get why C<q()> is used in place of
C<qq()>. The latter perfectly expands I<$foo> and I<$bar>.

May be I've missed something again, but I failed to find in neither
question nor answer any notion that I<$foo> and I<$bar> are undefined at
compile time. BTW, the answer misses either discussion or redirection
why C<$string = eval { "Say hello to $foo and $bar"; };> is bad.

--
Torvalds' goal for Linux is very simple: World Domination
.



Relevant Pages