Section B.3. Chapter 4, Values and Expressions


B.3. Chapter 4, Values and Expressions

  • Use interpolating string delimiters only for strings that actually interpolate. [String Delimiters]

  • Don't use "" or '' for an empty string. [Empty Strings]

  • Don't write one-character strings in visually ambiguous ways. [Single-Character Strings]

  • Use named character escapes instead of numeric escapes. [Escaped Characters]

  • Use named constants, but don't use constant. [Constants]

  • Don't pad decimal numbers with leading zeros. [Leading Zeros]

  • Use underscores to improve the readability of long numbers. [Long Numbers]

  • Lay out multiline strings over multiple lines. [Multiline Strings]

  • Use a heredoc when a multiline string exceeds two lines. [Here Documents]

  • Use a "theredoc" when a heredoc would compromise your indentation. [Heredoc Indentation]

  • Make every heredoc terminator a single uppercase identifier with a standard prefix. [Heredoc Terminators]

  • When introducing a heredoc, quote the terminator. [Heredoc Quoters]

  • Don't use barewords. [Barewords]

  • Reserve => for pairs. [Fat Commas]

  • Don't use commas to sequence statements. [Thin Commas]

  • Don't mix high- and low-precedence booleans. [Low-Precedence Operators]

  • Parenthesize every raw list. [Lists]

  • Use table-lookup to test for membership in lists of strings; use any( ) for membership of lists of anything else. [List Membership]



Perl Best Practices
Perl Best Practices
ISBN: 0596001738
EAN: 2147483647
Year: 2004
Pages: 350
Authors: Damian Conway

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net