PBP: 034 Empty Strings

The PBP suggests never using “” or ” for empty strings, and using q{} instead.  Because clearly that’s so much more readable.The concern here is that ” (two single-quotes) might look like ” (a single double quote) on it’s own in some fonts.  I really think that context and, in a modern editor, syntax highlighting, will help keep the difference clear.  I don’t like the quote-like operators, and don’t think it’s worth dragging Perl back into the land of lines full of line-noise with the extra braces to protect some poor sucker from their poor font choice.

Using a pair of double quotes remains unambiguous and is, in my opinion, much clearer.  I’m horrified to discover my empty string might interpolate something by accident!  I just can’t care, and find it too ugly to use.

This is one of the PerlCritic warnings I turn off right away.

Leave a Reply