Tag Archives: style

Perl Style

A little about Perl style from perldoc.

  1. Run under –w flag all times
  2. Run under “use strict”
  3. Can also use “use sigtrap” or “use diagnostics”
  4. Closing curly bracket of a multi-line block should line up with the keyword that started the construct
  5. 4-column indent
  6. Open curly on same line as keywork, if possible, otherwise line up.
  7. Space before the opening curly of a multi-line block.
  8. One-line BLOCK may be put on one line, including curlies.
  9. No space before the semicolon.
  10. Semicolon omitted in “short” one-line BLOCK.
  11. Space around most operators.
  12. Space around a “complex” subscript (inside brackets).
  13. Blank lines between chunks that do different things.
  14. Uncuddled elses.
  15. No space between function name and its opening parenthesis.
  16. Space after each comma.
  17. Long lines broken after an operator (except “and” and “or”).
  18. Space after last parenthesis matching on current line.
  19. Line up corresponding items vertically.
  20. Omit redundant punctuation as long as clarity doesn’t suffer.
  21. When in double, parenthesize