----- Original Message -----
From: M.W. Koskamp <[EMAIL PROTECTED]>
To: Me <[EMAIL PROTECTED]>; Christodoulou Demetris
<[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, May 03, 2001 10:52 AM
Subject: Re: How to implement Variable variable names?


>
> ----- Original Message -----
> From: Me <[EMAIL PROTECTED]>
> To: Christodoulou Demetris <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
> Sent: Thursday, May 03, 2001 10:26 AM
> Subject: Re: How to implement Variable variable names?
>
>
> > > Hi,
> > > I am writing an application where i have to read
> > > from a file variable names and variable values.
> > > Is there is a way to use Variable Variables  with
> > > the same way used in php?
> > > For example:
> > > $a = "hello";
> > > $$a = "world";
> > > where echo "$a ${$a}";  and  echo "$a $hello";  would output the same.
> > > Thanks in advance,
> > >    Demetris.
> >
> > You can actually execute the above php code
> > under perl and it will work!
> >
> > (You need to add
> >
> >     sub echo ($) { print shift }
> >
> > at the start to let perl know what to do with
> > echo, or you could just replace 'echo' with
> > 'print'.)
>
> But it is not gonna do what he wants.
>
Ok it does work, but us is still a bad idea.
It won work with use strict.
Besides it makes your code less readable cuz it is hard to see if you are
dereferencing a scalar or using some magic to create a dynamic variable.


Reply via email to