Variable Naming [was Re: [] catching $a, $b unnecessary my and maybe other things]

Omer Zak omerz at
Sun Jun 6 12:16:44 PDT 2004

Shlomi Fish wrote:

> Well, naming variables is something that requires some thinking. For once, I 
> disagree that giving variables long names is a healthy practice, just because 
> your editor has auto-completion. You can't rely on the editor having that 
> (joe, classic vi, etc.), and extremely long variable names make the code more 
> difficult to read because less code can be fit on one line.

I disagree with the belief that short variable names are better.
When you use long names, you can grep for all occurrences of a variable 
in your code.

This is very useful during maintenance to ensure that you miss nothing 
when you make systematic updates.

When you don't have too many false positives when grepping for a 
variable, you can use that grep to locate all places, which need to be 
modified as long as that variable is associated in some way with those 

If you use 'i', then you would have too many false positives.
                                              --- Omer
My own blog is at

My opinions, as expressed in this E-mail message, are mine alone.
They do not represent the official policy of any organization with which
I may be affiliated in any way.

More information about the Perl mailing list