Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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
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

In reply to Re: camelCase vs snake_case by Athanasius
in thread camelCase vs snake_case by morgon

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others drinking their drinks and smoking their pipes about the Monastery: (5)
    As of 2018-01-17 03:33 GMT
    Find Nodes?
      Voting Booth?
      How did you see in the new year?

      Results (196 votes). Check out past polls.