Re: underscores ($name_$foo) in string assignments

Jesse Reynolds
Thu, 15 Feb 2007 01:26:51 -0000

On 15/02/2007, at 12:18 PM, Kenton Brede wrote:

> On 2/14/07, Jesse Reynolds <jesse@va.com.au> wrote:
>> Hello
>>
>> In a component, I was trying to do:
>>
>>         $bar = "lets make a new string with $name_$foo in
it."
>>
>> however the "$name_" fails to appear in the resulting string:
>>
>>         "lets make a new string with valueOfFoo in it."
>>
>> Is there something special about $name_ here?
>>
>> If I replace the underscore with a dash (... $name-$foo ... ) it
>> works fine.
>
> Have you tried ${name}_${foo}  ?  If you''re going for something
like:
> $name = foo
> and
> $foo = bar
> and expecting result, "foo_bar."

Ah, thank you. So I guess it was looking for a variable $name_ which
doesn''t exist.