Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

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?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (11)
As of 2016-10-24 16:22 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (309 votes). Check out past polls.