[Israel.pm] Ho do I get the name of a variable?
Offer Kaye
offer.kaye at gmail.com
Thu Jul 27 14:28:04 EEST 2006
On 7/27/06, Ido Perelmutter wrote:
> That's really unnecessary. Simply use a backslash
Because in this specific case I don't want the leading sigil, just the
variable *name*. See my answer to guy, below...
On 7/27/06, guy keren wrote:
> why would you want to remove the trailing character? it adds ambiguitiy,
> since @some_name, $some_name and %some_name are 3 different variables.
>
> when i print variable names, i just print them. why add confusion?
>
> --guy
>
It's true that Perl allows different variables with the same name, but
I consider it bad form and very confusing to use this ability. If
someone who is not a Perl guru tries to maintain your code later on he
can easily get confused by $name[0] and $name->[0].
Since I don't use the same name for different variables, there is no
problem of ambiguity in my code.
Regards,
--
Offer Kaye
More information about the Perl
mailing list