Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: var comparison

by Marshall (Monsignor)
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://992617]
help
Chatterbox?
Discipulus some monks here around are flammable.. or well they interact like a porcupine and an airbaloon
[beech]: yes, farting is an apt description for a lot of the irrelevant hot gas

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (9)
As of 2017-01-20 08:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (174 votes). Check out past polls.