[tpm] hash naming convention: singular or plural
Abram Hindle
abram.hindle at softwareprocess.us
Fri Aug 8 07:46:24 PDT 2008
Alexander Anderson wrote:
> Hello Toronto Perl Mongers,
>
> Names of scalars are usually singular, for example,
>
> $month = 'Aug';
>
> Names of arrays are usually plural, for example,
>
> @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
>
> How do you name your hashes, for example,
>
> %months = ( Jan => 1, Feb => 2, ..., Dec => 12 );
> or
> %month = ( Jan => 1, Feb => 2, ..., Dec => 12 );
>
IMHO,
You are already indicating scalar/vector by their first character.
Just use a consistent lexicon for your project. Being consistent is more
important than spending a lot of time worrying about how natural and
english your variable name choices sound.
abram
More information about the toronto-pm
mailing list