KW.pm Perl Style Guides #17

Slash Style Guide: Style 2

  • Method and Function names

    • Begin with a verb, and describe the action taken.

      $obj->get_story();

    • private functions: begin with _ (not enforced by the code, but by convention)

  • In large for() loops, don't use $_, but name the variable.

  • "When in doubt, parenthesize..."

           When in doubt, parenthesize.  At the very least it
           will let some poor schmuck bounce on the % key in vi.
           Even if you aren't in doubt, consider the mental wel-
           fare of the person who has to maintain the code after
           you, and who will probably put parentheses in the
           wrong place. -- larry wall, perlstyle

<< Previous | Index | Next >> Copyright © 2002 Daniel Allen