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

Actually, many of us saw it. But we also saw this: Re: To Single Quote or to Double Quote: a benchmark. The point is, the difference in speed is practically meaningless. In the grand scheme of the transition from $value =~ /true/i to lc $value eq "true", changing that to lc $value eq 'true' is going to have a demonstrably small effect.

Replies are listed 'Best First'.
Re^3: You don't always have to use regexes
by bmann (Priest) on Feb 24, 2005 at 23:41 UTC
    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.

      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