Hi,

I'm working my way through Learning Perl (6th) and Modern Perl (4th) and
was wondering whether there are any (non-obvious) drawbacks to the
different string quoting methods.

First up, double-quoted strings. The "usual method" of double-quoting
has an alternative of qq{For a string with $variable interpolation};

qq{} obviously wins when there would otherwise be a lot of escaping, but
are there any downsides of using this method more generally (other than
double-quotes being two characters shorter)? For example, is it "faster"
for Perl to parse a double-quoted string or does the compiler optimise
this out so the methods are fundamentally equivalent?

Second, single- vs. double-quoted strings for non-interpolated use. In
Ruby, I've been given the impression* that single-quoted strings are
"more efficient" than double-quoted strings when interpolation is not
required (that is, prefer 'Bob' over "Bob"). I'm wondering whether there
is any similar recommendation for Perl?

Thanks in advance!

J

* Maybe from an HN discussion?

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to