This would be the logical way to do it (as I see it):

$a = "dog";
$new_var = MY.$a;

$$new_var and $pre_dog are the same :)


On Fri, Nov 16, 2001 at 09:47:12PM -0500, Jeff Lewis wrote:
> I've a question regarding variable variable I was hoping someone could help me with:
> All the examples in the manual have the entire variable name being variable e.g.
> $a = "hello"   and
> $$a being the same as $hello
> What I need to do, however, is append a variable portion to a constant prefix.  So I 
>have a set of variables that are named $MYdog, $MYcat etc. and I need to do
> $a = "dog"
> ${"MY$a"} being the same as $MYdog
> Can this be done, and if so - how? I can't get it to work.
> Jeff

"How would this sentence be different if pi equaled 3?" 

Attachment: msg40409/pgp00000.pgp
Description: PGP signature

Reply via email to