KW.pm Perl Style Guides #16

Slash Style Guide: Style 1

  • much is taken from perlstyle

  • uses both OO and procedural programming

  • Variable names

    • typically, lower case variable names with underscores separating words

    • use English hints:

      • Generally, variables form a noun

        $this_var = 'foo';

      • Arrays and hashes should be plural nouns

      • Don't use "_ref" to name references

      • references tell you whether they point to a var or a list

        @stories     = (1, 2, 3);      # right
        $comment_ref = [4, 5, 6];      # wrong
        $comments    = [4, 5, 6];      # right
        $comment     = $comments->[0]; # right

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