On Mon, Sep 5, 2011 at 11:51 AM, Uri Guttman <u...@stemsystems.com> wrote: > there is no such thing as module scope. our declares package globals and > give them a short name in a lexical scope.
Ah, yes, thank you for correcting me. :) The line between "module" and "package" had blurred on me. Google cleared that up. > single letter variable names are bad in general. they tell you nothing > about the use and content of the variable. about the only exception are > $i and $j for array/matrix indexing and the aforementioned $a and $b for > scoping. I'm used to writing C# and in my experience descriptive variable names become both tiresome and difficult to read. Instead, I usually try to keep functions/subroutines short and give variable names a mnemonic meaning. If it is not obvious what the variable's purpose is then I'll leave a comment next to its declaration (often in C# the type alone describes the variable sufficiently though). I do use descriptive names when the code requires it, but I don't make it a rule to always use them. I find that code is often more difficult to read when the names exceed a few characters. It's important to see what a variable represents, but it's also important to see how that variable interacts with the code around it. This habit is somewhat holstered due to Perl's use of global variables with short names, like $a and $b. I don't remember if there are any other /\$[A-za-z]/ variables, but to be safe I generally avoid using single character names in Perl (well, OK, also to avoid getting "told" on this list when I post my code). I guess variable name length is less of an issue in Perl though because the language is so much more terse all by itself :P -- Brandon McCaig <http://www.bamccaig.com/> <bamcc...@gmail.com> V zrna gur orfg jvgu jung V fnl. Vg qbrfa'g nyjnlf fbhaq gung jnl. Castopulence Software <http://www.castopulence.org/> <bamcc...@castopulence.org> -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/