http://qs1969.pair.com?node_id=434312


in reply to Re^2: You don't always have to use regexes
in thread You don't always have to use regexes

And to support your point, an invariant string inside double-quotes gets compiled down to a single quoted string. Any time wasted is not wasted at run-time.

$cat print.pl print 'Hello'; print "Hello"; # compiles to 'Hello' print "Hello $_"; $perl -MO=Deparse print.pl print 'Hello'; print 'Hello'; print "Hello $_"; print.pl syntax OK

5.005_03, 5.6.1 and 5.8.4 produce identical results.

Replies are listed 'Best First'.
Re^4: You don't always have to use regexes
by Ven'Tatsu (Deacon) on Feb 25, 2005 at 14:28 UTC
    Minor nitpick, if your going to use B::Deparse to show how perl handles strings internaly consider using the -q option. From B::Deparse:
    Expand double-quoted strings into the corresponding combinations of concatenation, uc, ucfirst, lc, lcfirst, quotemeta, and join. ...
    Note that the expanded form represents the way perl handles such constructions internally -- this option actually turns off the reverse translation that B::Deparse usually does.
    $perl -MO=Deparse,-q print.pl print 'Hello'; print 'Hello'; print 'Hello ' . $_; print.pl syntax OK