Very rarely do I not test code I post. I know I'm mortal,
and code of mine can have errers [
sic]. But
as for my coding style, I tend to do the following:
- BLOCKs are started with a brace on the line with the
control structure (or function definition), and, except for
one-liners, have all EXPRs in them on subsequent lines
sub NAME {
EXPR;
EXPR;
}
sub NAME (PROTO) {
EXPR;
EXPR;
}
if (EXPR) { EXPR }
- Semicolons are optional after one-liners (like above)
- Closing braces appear on lines by themselves (except
for in the case of one-liners (that means I do NOT "hug" my
else's)
if (EXPR) {
EXPR
}
else {
EXPR
}
- I use 2-space indents
- Space between 'if' and '(', and between ')' and '{' (as
shown above)
- No space between function name and '('
foo(1,2,3);
bar({
a => $str,
b => $trs,
});
There's a myriad of other things I do, which can of course
be divined from my code fragments I display on the site (or
my programs you happen to come across).
$_="goto+F.print+chop;\n=yhpaj";F1:eval