Perl Best Practices (@perlbpbook) profile picture

Perl Best Practices offers a collection of 256 guidelines on the art of coding to help you write better Perl code--one a day, every work day, for a year.

Sebastopol, CA
Joined January 2009
Remember when O'Reilly used to publish Perl books? Yeah, me too.
4
3
Use full-line comments to explain the algorithm. http://bit.ly/oHsrx
Use block templates for major comments. http://bit.ly/oHsrx
Subdivide your technical documentation appropriately. http://bit.ly/oHsrx
Place POD as close as possible to the end of the file. http://bit.ly/oHsrx
Keep all user documentation in a single place within your source file. http://bit.ly/oHsrx
Put user documentation in source files. http://bit.ly/oHsrx
Extend and customize your standard POD templates. http://bit.ly/oHsrx
Create standard POD templates for modules and applications. http://bit.ly/oHsrx
Distinguish user documentation from technical documentation. http://bit.ly/oHsrx
Label every loop that is exited explicitly, and use the label with every next, last, or redo . http://bit.ly/oHsrx
Use for and redo instead of an irregularly counted while . http://bit.ly/oHsrx
Don't contort loop structures just to consolidate control. http://bit.ly/oHsrx
Reject as many iterations as possible, as early as possible. http://bit.ly/oHsrx
Don't use do...while loops. http://bit.ly/oHsrx
1
When producing a value, use tabular ternaries . http://bit.ly/oHsrx
Use table look-up in preference to cascaded equality tests . http://bit.ly/oHsrx
1
Avoid cascading an if . http://bit.ly/oHsrx
Never modify $_ in a list function. http://bit.ly/oHsrx
Use a subroutine call to factor out complex list transformations . http://bit.ly/oHsrx