[LA.pm] Double versus single quotes

John W. Palmieri john at mediaOnFire.com
Tue Nov 25 13:17:46 CST 2003


25 November 2003

Hi:

A technical question for anyone who has a spare minute:

When I'm using strings in Perl I try to use single quotes 
for static strings (e.g., 'This string is static') since I 
figure that the interpreter won't have to work as hard as it 
doesn't have to look for variables, escapes, etc. (e.g., 
"This is a $dynamic string\n"). I have no evidence that this 
makes a difference, but it seems reasonable. Is it?

Also, when building an output string I'll tend to use long 
static strings followed by the dot (.) concatenator for 
inserting variables using the same reasoning. I'm asking 
this question since I've come around that this may not be 
the most efficient since with every concatenation it may 
have to do exec a bunch of constructors and copies?

Anyone have thoughts on these (small) issues?

Cheers and TIA,
John




More information about the Losangeles-pm mailing list