Help for this page

Select Code to Download


  1. or download this
    # 0. Just-in-time variable declaration and initialization.
    
  2. or download this
    # 1. Variables in consistent case (all lower or all upper)
    
    ...
        $BAZ
        $FOO_BAR
    );
    
  3. or download this
    # 4. Global lexicals in all lower case, and 
    #     prefixed with some text to mark them as such.
    #     For example...
    my ($glob_foo, $glob_bar, $glob_baz, @glob_foo_bar);
    
  4. or download this
    # 5. Local lexicals on all lowercase
    sub foo {
    ...
        }
        return $bar;
    }
    
  5. or download this
    # 5.5. Use prefixes to scope other logically different 
    #      vars. For example, 'cgi_' to prefix vars holding 
    ...
    
    # 7. Rules 1-5 apply to rule 6 as well... so, an array ref 
    #    inside a sub would be $this_aref_bar, etc.
    
  6. or download this
    # 8. modified: I like camelCase, however, the real purpose
    # here is to visually distinguish a sub from a var. Choose 
    ...
    # 9.5. Never export anything by default.
    
    @EXPORT_OK
    
  7. or download this
    # 10. Always pass named vars to subs
    doThis('with' => $that, 'and' = $something_else);