Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Disadvantage of using 'eq' operator to compare numbers.

by biohisham (Priest)
on Jan 01, 2010 at 12:54 UTC ( #815181=note: print w/ replies, xml ) Need Help??


in reply to Disadvantage of using 'eq' operator to compare numbers.

Strings can look like 0 to the == operator and you can get into uncalled for hithces if you swap the string and numeric operators:
$apples = "apples"; $oranges = "oranges"; if($apples == $oranges){ print "$apples and $oranges are the same"; }else { print "$apples and $oranges are not the same"; }



Excellence is an Endeavor of Persistence. Chance Favors a Prepared Mind.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2016-06-25 12:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (325 votes). Check out past polls.