- or download this
# 0. Just-in-time variable declaration and initialization.
- or download this
# 1. Variables in consistent case (all lower or all upper)
...
$BAZ
$FOO_BAR
);
- 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);
- or download this
# 5. Local lexicals on all lowercase
sub foo {
...
}
return $bar;
}
- 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.
- 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
- or download this
# 10. Always pass named vars to subs
doThis('with' => $that, 'and' = $something_else);