Luke Palmer wrote:

Admittedly, if you use == for everything, you can force string or
numeric comparison this way:

if +$a == +$b {...} # numeric
if ~$a == ~$b {...} # string


Hmm.
In my head, I would expect == to have implicit numification on the operands (unless user-overloaded to something else, but that's different). In turn, I'd expect eq to have implicit stringifies.


Therefore I'd expect the +'s to redundant in the first example.

I'd then expect the second example to first convert $a and $b to strings because of the ~'s, then, because it sees the ==, it would numify those strings and do a numeric compare.

Are my expectations misaligned here?

-- Rod





Reply via email to