Archive for the ‘Perl’ Category

PBP: 052 Package Variables

Monday, October 27th, 2014

The PBP suggests avoiding package variables.  I almost can’t think of a reason to use one, so support this suggestion. (more…)

PBP: 051 Lexical Variables

Thursday, October 23rd, 2014

Global Variables; Just Say No.  Well, the PBP’s a little more lenient than that, and actually easier to follow by suggesting, “Avoid using non-lexical variables.” and admitting there are some times you just need a package or global variable. (more…)

PBP: 050 List Membership

Monday, October 20th, 2014

The PBP suggests using the right, fast, tools to search for strings in lists.  Who wouldn’t? (more…)

PBP: 049 Lists

Thursday, October 16th, 2014

This best practice is a simple suggestion: Put every raw list in parenthesis.  It’s good. (more…)

PBP: 048 Low-Precedence Operators

Monday, October 13th, 2014

The best practice is not to mix low and high precedence boolean operators.  This is both good and bad, but following the rule can save your sanity. (more…)

PBP: 047 Thin Commas

Thursday, October 9th, 2014

The PBP cautions us not to use commas to separate and sequence statements.  I think this is good advice most of the time. (more…)

PBP: 046 Fat Commas

Monday, October 6th, 2014

Perl has a weird but cool operator, the “fat comma”, written as =>.  It’s a comma, but with a special property that means a bareword on the left side is allowed.  They’re often used for initializing hashes without having to quote every hash key.

The PBP suggests reserving => for items that go together, or, as it says “for pairs”.  Name => value pairs, mostly.  These things are related to each other and => makes that visible.  (more…)

PBP: 045 Barewords

Thursday, October 2nd, 2014

Perl supports “barewords”, which are strings that just sit naked in your program.  If it isn’t parsable code, it’s a bareword.  The PBP says: Don’t.  I agree, as does ‘use strict’, which I always use. (more…)

PBP: 044 Heredoc Quoters

Monday, September 29th, 2014

The PBP suggests that all heredocs be explicitly and deliberately quoted.  When I first read this, I didn’t know you could do that!  It’s a great idea. (more…)

PBP: 043 Heredoc Terminators

Thursday, September 25th, 2014

Mr. Conway suggests making all heredoc terminators single uppercase identifiers which start with a standard prefix.  This is part of naming things regularly, and I support it. (more…)