The stupid question is the question not asked | |
PerlMonks |
Re: Equality operatorsby davorg (Chancellor) |
on Apr 25, 2006 at 11:43 UTC ( [id://545542]=note: 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 Section
Seekers of Perl Wisdom
|
|