Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Equality operators

by davorg (Chancellor)
on Apr 25, 2006 at 11:43 UTC ( [id://545542]=note: print w/replies, xml ) Need Help??


in reply to Equality operators

== is the numeric equality operator. It compares its operands as numbers. Therefore any strings are given a numeric value before the comparison takes place. Perl does this by looking for numbers at the start of the string. If none are found then the string is given the value 0. This is why 'a' and 'b' appear to be equal (they are both converted to zero).

For string comparisons, use 'eq'.

--
<http://dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (4)
As of 2024-04-25 15:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found