Pathologically Eclectic Rubbish Lister | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Is there a way to override this so that things belonging to different data types are always not equal? I'm not sure if I understood your application, you're comparing "nodes" which can be strings or regexes or other data types, right? So wouldn't it be natural to construct a class "Node", with an overloaded "eq" operator? (¹) If your goal is to compare different node-objects, why don't you implement them as objects? If you also tie these object-refrences you can use them like normal scalars. So the answer is yes you might be able override this behaviour ;-)
Cheers Rolf FOOTNOTE: (1) hmm I think I'd rather prefere to overload == In reply to Re^2: What is the best way to compare variables so that different types are non-equal?
by LanX
|
|