From http://www.perldoc.com/perl5.6/pod/perlstyle.html
(also in ProgrammingPerl) -
- While short identifiers like $gotit are probably ok, use underscores to separate words. $got_it is much clearer.
- It is generally easier to read $var_names_like_this than $VarNamesLikeThis, especially for non-native speakers of English. (see: UnderscoreVersusCapitalAndLowerCaseVariableNaming) AmericanCulturalAssumption: For a german reader like me it may actually be easier with capitals.
- It's also a simple rule that works consistently with VAR_NAMES_LIKE_THIS.
- Package names are sometimes an exception to this rule.
- Perl informally reserves lowercase module names for "pragma" modules like integer and strict.
- Other modules should begin with a capital letter and use mixed case, but probably without underscores, due to limitations in primitive file systems' representations of module names as file names that must fit into a few sparse bytes.
Using embedded underscores means you used up an important character without thinking about the future. Underscores can be used to make a suffix attached to a function. Using them up ahead of time means you have wasted an important character.
I use two underscores to separate prefix from suffix: big_widget__refrobnicate_the_foncicle()
Using embedded_underscore is one of many possible CapitalizationRules for attaching several words together.