There's more than one way to do things | |
PerlMonks |
Re: Confusion in naming variables in subroutinesby rkrieger (Friar) |
on Jan 24, 2007 at 01:18 UTC ( [id://596180]=note: print w/replies, xml ) | Need Help?? |
As a general advice, pick variable names that clearly and specifically describe what they contain. In the long run (e.g. when you need to look at the code again in several months), that will keep things easier for you.
For a sub in which you calculate volumes and/or areas and the like, you can probably suffice with more 'generic' names such as $length, $width, $height, etc.
As you mentioned, little prevents you from scoping the variables and naming them similarly. Do as you prefer, of course, but from a maintainability perspective I recommend you make things stand out (i.e. use different names).
--
If you don't know where you're going, any road will get you there.
In Section
Seekers of Perl Wisdom
|
|