Just another Perl shrine | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
== 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." In reply to Re: Equality operators
by davorg
|
|