For whatever reason I am having trouble finding a list of rules to follow when coding Perl. I am developing my own list and here is what I have:
  1. Always begin your Perl programs by calling 'use strict' which enforces declaration of variables and other proper coding practices. Failure to call 'use strict' means, for instance, that typos in variable names may not be caught.
  2. When declaring Perl variables you should set their scope using the 'my' keyword. Only make your variables global if there is some reason for them to be global. Do not declare your variables as 'local' as this keyword in Perl has a special meaning and is intended only for backwards compatibility and for very special cases.
  3. Name your variables consistently throughout your script. One approach is use lowercase for the first letter of the first word of a variable name, uppercase for the first letter of all other words in a variable name, and lowercase for all other letters. Another approach is to separate all words in variable names using underscores.
  4. All Perl filehandles should be in all uppercase.
  5. When doing CGI programming always use CGI.pm, e.g., 'use CGI qw(:standard)'
  6. When doing CGI always (very important) retrieve variables from forms using CGI.pm's param() function. Never attempt to parse the form variables directly, as special characters in the form variables such as spaces will probably break your script.
  7. If you need to install a Perl module download it from www.cpan.org. CPAN is the standard repository for Perl modules. Avoid using modules which are not listed at CPAN.

In reply to Rules of Proper Perl Style by sierrathedog04

Title:
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, details, 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, summary, 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.