in reply to Re: In Love With Double Quotes
in thread In Love With Double Quotes

If you don't interpolate variables, you must end up with some pretty messy code.

Instead of
print "On $todays_date you have received $num_emails emails from $num_ +people people in mailbox $mailbox\n";
you would prefer this?
print 'On ' . $todays_date . ' you have received ' . $num_emails . ' e +mails from ' . $num_people . ' people in mailbox ' . $mailbox . '\n';
IMHO, the former is quite a bit easier on the eyes.

Replies are listed 'Best First'.
Re^3: In Love With Double Quotes
by rir (Vicar) on Aug 12, 2005 at 01:21 UTC
    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