in reply to Single Quotes Versus Double Quotes

It's not true as Perl converts the unnecessary double quotes to single quotes as it compiles your code. Of course, you could argue that this conversion takes time, but it's going to be negliable.

But I always make a point of using single quotes when that's what is needed. Not for the compiler, but for my maintenance programmer (who might very well be me in a few months time). In my opinion, putting double quotes around a string is a single to the programmer that "something" is going on in that string and that you need to be a bit more careful when changing the contents of that string.

--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

Replies are listed 'Best First'.
Re^2: Single Quotes Versus Double Quotes
by Anonymous Monk on Oct 13, 2006 at 10:36 UTC
    Future maintainance work is exactly the reason I use double quotes. I find it not to be uncommon that I later want to add a variable in a string to be printed. Having to change to quotes is work I try to avoid.

    And programmers that get confused when encountering double quotes, but nothing to interpolate. Well, sorry, but if that confuses you, you shouldn't be programming at all. Or at least, not in Perl.

      I'm not saying that it confuses me. I'm saying that I use it as a flag to myself (or whoever is editing my code). Single quotes denote a string with no variable interpolation or special escape sequences. It seems obvious and useful to me.

      And, yes, I sometimes have to change quote characters when I'm editing code. I see that as part of keeping the code as readable as possible.

      I'm glad to see that Damian Conway agrees with me (see section 4.1 of Perl Best Practices).

      --
      <http://dave.org.uk>

      "The first rule of Perl club is you do not talk about Perl club."
      -- Chip Salzenberg