Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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 drinking their drinks and smoking their pipes about the Monastery: (13)
As of 2015-07-30 17:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (273 votes), past polls