I agree. I am the only person I know of who has gone on record has having intentionally tried both types as my default quoting style (
A guide to coding Perl). I vote for double-quotes in the common case; when you consider that interpolation was designed to be convenient it is not surprising that it is.
There have been many arguments in favor of using single-quotes as a marker that no interpolation is going to happen. This implies that double-quotes denote that interpolation is going to happen. I find this a subtle sort of commenting and would not count on any one's self discipline to be consistent at it unless I knew there was an effective system to enforce it. The idea shows an attention to detail that I can respect but I find the convention uninteresting and uninspiring. Usually strings are just not that interesting from a programmer's perspective.
Often I may start a string without much thought as to what all will be in it when its contents are finalized.
There are situations where quoting styles are worth attention. When generating templating text or code
that has lots of special characters; in such cases it is worth avoiding " and ' and using the other quoting methods.
Be well,
rir
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.