Home  |  Linux  | Mysql  | PHP  | XML
From:Uri Guttman Date:Fri Sep  3 06:47:11 2010
Subject:Re: Traversing Hash printing two times
>>>>> "JWK" == John W Krahn <jwkrahn@shaw.ca> writes:

JWK> Uri Guttman wrote:
>>>>>>> "JD" == Jatin Davey<jashokda@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.

JWK> Yes, and using $month for the keys 'english' and 'french' does not
JWK> really do that. Perhaps using $language would have been better?

my bad. i was seeing months all over the code so that stuck.

uri

--
Uri Guttman ------ uri@stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
Navigate in group perl.beginners at sever nntp.perl.org
Previous Next


Your recent visits
Re: Traversing Hash printing two times
Re: AW: Using common object, without passing it around
HTML::Template, CGI::APP with the JSON + Jquery please help.
Re: script for shutdown remote machine
Re: help on example from "mastering algorithm with perl" on binarysearch



  
© No Copyright
You are free to use Anything, but please consult your advocate before doing so as this website
also list content from other sources which may be copyrighted.
Site Maintained by Zareef Ahmed
Powered By PHP Consultants