Uri Guttman wrote:
"JD" == Jatin Davey<jasho...@cisco.com> writes:
>> but it isn't as good as my code. don't use $_ unless you have to (as in
>> map/grep). it is much better to use named variables.
JD> Any reason to use named variables than to use the default variable ($_)
?
yes, you can read the code and see what the variable is for. $_ is
useful in some situations but not for foreach loops and similar
things. names are important in code and $_ has no name. you lose the
opportunity to tell the reader of the code what the variable contains
and what it is used for.
Yes, and using $month for the keys 'english' and 'french' does not
really do that. Perhaps using $language would have been better?
John
--
Any intelligent fool can make things bigger and
more complex... It takes a touch of genius -
and a lot of courage to move in the opposite
direction. -- Albert Einstein
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/