[Melbourne-pm] Single vs double quotes: no real difference (was Re: Delivering PDFs via CGI)

Joshua Goodall joshua at roughtrade.net
Tue Jun 20 14:40:54 PDT 2006


On Tue, Jun 20, 2006 at 05:14:40PM +1000, Sisyphus wrote:
> Anyway ... my basic thinking is that you should use single quotes unless
> double quotes are needed .... or unless there's some convention that
> dictates the use of double quotes .... or unless you inadvertently use
> double quotes in a moment of distraction :-)

Having been fed too much C when I was young, I tend to write:

$foo = "String Literal";
$char = 'X';

go figure.

I did think around this for a moment and tried to come up with some guiding
rule where you hint at never wanting an interpolative context by using
single quotes rather than double (example might be any string that is
later passed to a shell invocation).

But I couldn't find where that'd be a logical superset of using q{} vs qq{}
for clarity, or be better than the taint mechanism.

Personally I use vim with syntax highlighting to read code whenever possible.
As a result all string literals come up in red - so I'm not even aware of
which quoting style was used; I don't perceive it unless I want/need to.

/k


-- 
Josh "Koshua" Goodall                      "as modern as tomorrow afternoon"
joshua at roughtrade.net                                       - FW109


More information about the Melbourne-pm mailing list