Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
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.


Comment on Re: Disadvantage of using 'eq' operator to compare numbers.
Select or Download Code

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 wandering the Monastery: (8)
As of 2014-07-28 09:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (193 votes), past polls