http://qs321.pair.com?node_id=781773


in reply to Re^2: What is the best way to compare variables so that different types are non-equal? (overloading "cmp")
in thread What is the best way to compare variables so that different types are non-equal?

Well as I already said
I certainly don't recommend it for production use
, a simple comparison function is much easier to maintain. But Beth asked for options with overloading, and thats the answer.

If one really needs the behavior of a JS-like === very often this could be a way to achieve it. The old behavior of comparing only the stringified values could still be achieved by explicitly stringifying the arguments, e.g.:  "$rx" cmp "$ry".

IMHO not overloading is the problem in perl5 but the lack of alternative or freely named operators. Actually overloading results in compatibility problems.

Anyway the fact that it's "a global change of regex" really surprises me, I expected it to be reduced only to the scope of the file...

Cheers Rolf