Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re^3: var comparison

by Marshall (Prior)
on Sep 09, 2012 at 19:14 UTC ( #992617=note: print w/ replies, xml ) Need Help??

in reply to Re^2: var comparison
in thread var comparison

I think that $var eq 'foo' || $var eq 'bar' will work very well. If $var is say 'xyz', the string compare will be abandoned at the first letter. "Oh, its not an 'f', lets see if the first letter is an 'b' ... The regex engine is amazing but an expression like this will just call a low level 'C' function that is very efficient.

My point is that "shorter" source code is not necessary "better" in terms of efficiency or readability.

Comment on Re^3: var comparison
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2015-11-26 10:20 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (697 votes), past polls