In recent days many of our meditations around the monastery concerned some deeply involved issues such as this, or this, or that other thing over there. These and many others are certainly quite healthy discussions and deserve the credit they in fact already got. However, there has been little attention given to the subtle intricacies of performing daily Perl hacking routines. In this thread, I would like to draw your attention and, of course, pursue a constructive consultation on the sometimes overlooked and at the first glance trivial subject of variable naming.

Certainly, many of you would shout and even point me in the direction of one of these exceptional threads:

And that’s about all we have that is at least remotely related to this subject.

. . . vladb shuffles his old ‘Code Complete’ book a couple pages . . .

Ahh, here I found it, quote:

“You can’t give a variable a name the way you give a dog a name – because it’s cute or it has good sound. Unlike the dog and its name, which are different entities, a variable and a variable’s name are essentially the same thing. When it comes to variable naming conventions, a couple obvious rules spring to mind:

There’s certainly more to this list, but let me direct your attention to at least a few naming conventions specific to Perl. In addition to the ones mentioned above, throughout my short career as a Perl hacker, I have observed other developers follow this guidelines:

There are certainly hundreds more examples of indecent variable naming. I hereby challenge you to step forward and share your wisdom! ;-)

$"=q;grep;;$,=q"grep";for(`find . -name ".saves*~"`){s;$/;;;/(.*-(\d+) +-.*)$/; $_=<a HREF="/"> "," $2 </a>;`@$_ +`?{print"+ $1"}:{print"- $1"}&&`rm $1`; print$\;}

In reply to Of variable {mice} and its name {man}. by vladb

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.