Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: You don't always have to use regexes

by bmann (Priest)
on Feb 24, 2005 at 23:41 UTC ( [id://434312]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://434312]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2024-04-19 15:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found