[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Style Guidelines



John Springer <springer@scruznet.com> writes:
>I'm finding difficulty keeping my name spaces straight between subroutines
>and global variables.

Technically, this is of course not a problem - just use my($local).

>I've looked at several Perl style guides, but haven't seen anything
>definitive about naming variables, other the file handles in upper case.
>
>Is it OK - recommended - not recommended to do things like
>All global variables start with upper case letter
>All local variables start with _

Starting variable names with _ is an utterly bad idea in perl. Not only are
there special rules about variable names starting with _, they have even
changed between Perl4 and Perl5.

One plausible idea is to prefix global variables with a "g":

$gBigBadGlobalVariable = 1;

Matthias

-----
Matthias Neeracher   <neeri@iis.ee.ethz.ch>   http://www.iis.ee.ethz.ch/~neeri
   "There once was an Age of Reason, but we've progressed beyond it."
                                   -- Ayn Rand, _Atlas Shrugged_