http://www.perlmonks.org?node_id=215684


in reply to My coding guidelines

Excellent list. It's not often you see style guidelines along with some informative prose as to the why of the guidelines.

I was surprised by this part (24):

Note that there is whitespace between ++ and -- and their operands, and between -> and its operands.

What's the consensus on this one? I've always liked snug ++/-- and dereferencing:

++$wolverines; $rabbits--; $wombat->move(); $turtle = $menagerie->[4];

As opposed to:

++ $wolverines; $rabbits --; $wombat -> move(); $turtle = $menagerie -> [4];

For that matter, I've always made unary operators snug so that you can immediately find it's operand. This might be a holdout from C, but I do actually find the snug form more aesthetically pleasing.

On a somewhat visually related note, the arrow form of the left-associative operator works well with whitespace, however:

%myhash = ( lizard => 'gecko' );

Whereas the equivalent comma operator is snug with the left operand.

Thanks again for the list,
Matt