PBP: 076 List Processing Side Effects

January 19th, 2015

Mr. Conway suggests the very firm, “Never modify $_ in a list function.”  I’m torn on this. Read the rest of this entry »

PBP: 075 Complex Mappings

January 15th, 2015

The PBP suggests we factor complex map blocks into subroutines.  Please, please do this! Read the rest of this entry »

PBP: 074 List Transformation

January 12th, 2015

The last Best Practice suggested using map instead of a for loop to process lists.  There is an exception suggested by the Best Practices; if you’re transforming a list in place, use a for loop. Read the rest of this entry »

PBP: 073 List Selections

January 8th, 2015

The Best Practice is to use grep and first instead of for to refine or search lists.  Again, there are good reasons, but I find it difficult, and am only improving with deliberate practice. Read the rest of this entry »

PBP: 072 List Generation

January 5th, 2015

The Best Practice is to use map when generating a new list from an old one.  The reasoning is good, but I struggle with it anyway.  I’m getting better with effort. Read the rest of this entry »

PBP: 071 Non-Lexical Loop Iterators

January 1st, 2015

The statement made by this Best Practice is simple, “Always declare a for loop iterator with my.”  The reasoning behind it is complex, and surprised me.  I am sure I have screwed this up in the past, too.  It’s important as there’s a real gotcha here! Read the rest of this entry »

PBP: 070 Iterator Variables

December 29th, 2014

Mr. Conway suggests that you give explicit names for all for loops, and avoid the possibly confusing use of $_.  To this I say: Hallelujah! Read the rest of this entry »

PBP: 069 Necessary Subscripting

December 25th, 2014

In those places you do actually need both the key and value, you will have to go ahead and do the lookup on the key to get the value.  The PBP reminds us to only do that once, instead of many times in the loop. Read the rest of this entry »

PBP: 068 Unnecessary Subscripting

December 22nd, 2014

The Best Practice suggests avoiding subscripting arrays or hashes within loops.  They have a good reason too! Read the rest of this entry »

PBP: 067 C-Style Loops

December 18th, 2014

The Best Practices cast the use of C Style For Loops out of our lexicon.  Personally, I don’t get why this is, but haven’t needed them in a while. Read the rest of this entry »