Writing 2014-06-11
September 23rd, 2014Writing 2014-06-10
September 23rd, 2014PBP: 042 Heredoc Indentation
September 22nd, 2014The Best Practices suggest that putting a heredoc in a deeply nested function looks funny because it has to be left-justified, and suggests creating a “theredoc” by writing a function that does nothing besides evaluate and return the heredoc. Read the rest of this entry »
PBP: 041 Here Documents
September 18th, 2014The PBP tells us to use here documents when a multi line string is too long. It suggests two lines is long enough for a single string, and anything longer should be a here document. Read the rest of this entry »
PBP: 040 Multiline Strings
September 15th, 2014The PBP suggests breaking your strings on any embedded newlines so they look in code something like they’ll look when output. Read the rest of this entry »
PBP: 039 Long Numbers
September 11th, 2014Great big numbers full of digits are hard to read and be sure they’re right, so the PBP suggest using the magic underscore in the numbers to spread them out and make them more readable. Read the rest of this entry »
PBP: 038 Leading Zeroes
September 8th, 2014Best Practice: Don’t pad decimal numbers with leading zeroes. Read the rest of this entry »
PBP: 036 Escaped Characters
September 4th, 2014The PBP suggests using named escape characters instead of hardcoding ASCII values. It has some reasonable examples, such as this: Read the rest of this entry »
PBP: 035 Single-Character Strings
September 1st, 2014Much like empty strings, the PBP suggests being careful of how you write single character strings. It points out a number of them it considers “ambiguous”, including: Read the rest of this entry »
PBP: 037 Constants
August 30th, 2014Mr. Conway’s book suggests that constants are good but “use constant;” is the wrong way to go about them. It suggests the Readonly module. Later commenters have suggested Const::Fast instead. Feh, I say. Read the rest of this entry »