[Israel.pm] Ho do I get the name of a variable?

Levenglick Dov-RM07994 dovl at freescale.com
Sat Jul 29 12:39:26 EEST 2006


People who are not Perl gurus have no business mucking around code
written by Perl gurus :) 


 
Best Regards,
Dov Levenglick
DSP SoC System and Applications Engineer,
Network and Computing Systems Group
Freescale Semiconductor Israel
Tel. +972-9-952-2804
The information contained in this email is classified as:
[ ] Freescale General Business Information
[ ] Freescale Internal Use Only
[ ] Freescale Confidential Proprietary
[x] Personal Memorandum

-----Original Message-----
From: perl-bounces at perl.org.il [mailto:perl-bounces at perl.org.il] On
Behalf Of Offer Kaye
Sent: Thursday, July 27, 2006 14:28
To: Perl in Israel
Subject: Re: [Israel.pm] Ho do I get the name of a variable?

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
_______________________________________________
Perl mailing list
Perl at perl.org.il
http://perl.org.il/mailman/listinfo/perl




More information about the Perl mailing list