<?xml version="1.0" encoding="windows-1252"?>
<node id="477102" title="Re: Perl Best Practices" created="2005-07-22 00:57:12" updated="2005-08-14 16:22:34">
<type id="11">
note</type>
<author id="43019">
simonm</author>
<data>
<field name="doctext">
As I mentioned, there were a few stylistic guidelines that I don't adhere to; none of them strike me as flat-out wrong, but I've chosen to do things differently.

&lt;p&gt; For amusement value only, here's a list of things I'd do differently that I noticed while reading through today, mostly from the first few chapters:

&lt;ul&gt;
&lt;li&gt; Use two column indents rather than four.
&lt;li&gt; Omit semicolon after the final statement in a block if it is an explicit or implicit return.
&lt;li&gt; Cuddle elses and elsifs. (Add a blank line above if the else block forms a paragraph.)
&lt;li&gt; When breaking lines for an assignment, put the equal sign after the variable name.
&lt;li&gt; When breaking lines in a ternary expression, place the colon under the question mark for simple ternaries, or at the end of each line for cascading ternaries.
&lt;li&gt; Always put semicolons at the end of a line, never on a line by itself.
&lt;li&gt; It's OK to use implicit returns when a subroutine ends with delegation or calculation of the result.
&lt;li&gt; Use two-part version numbers for portability, not three-part version strings.
&lt;li&gt; Don't use a hash reference to hold named argument pairs when a regular list of pairs will do; getting an odd-number error at compile time rather than run-time isn't worth the extra punctuation this induces.
&lt;/ul&gt;

&lt;p&gt; For the more contentious suggestions, Damian does a good job of laying out the various pro and con arguments, so it's easy to see how a development team could use this this text as the basis of their style discussions and end up with a document that says "use the PBP style except for the following 5-10% set of local differences".</field>
<field name="root_node">
477093</field>
<field name="parent_node">
477093</field>
</data>
</node>
