http://www.perlmonks.org?node_id=990394


in reply to camelCase vs snake_case

Here is a summary of the advice offered by the Camel Book (4th Edition, p. 704) on the naming of identifiers in Perl:

Identifier Variable Subroutine
Constant $ALL_CAPS_HERE
Non-lexical filehandle FILE
Package-wide global $Some_Caps_Here
Package name CamelCase
Lexicals and subs $no_caps_here process_data
Private to a package $_leading_underscore _frobnicate

I do not advocate this style merely because it happens to be the one recommended in the language’s definitive reference. (I personally dislike the K&R style it recommends for brace placement, pp. 701–2.) But in this case I think the advice is useful, because the different naming conventions aid the reader in distinguishing the different ways in which identifiers are used in code.

As sundialsvc4 and Tux have said, consistency is the key. In a coding environment where programmers are likely to ignore style guidelines, a single one-case-fits-all style may be preferable (because easier to enforce). But in the general case, the visual distinctions provided by the various naming styles listed above aid comprehension and are worth learning, IMO.

Athanasius <°(((><contra mundum