in reply to overload =~ operator

I'm not sure if this is what you are looking for, but there is a perl module Class::Comparable where a base class is created for comparable objects. In the same respect, it overloads operators to achieve it goal. Your question was very generic, so this module may or may not apply.

Another possibility is, depending on the structure of your objects (or classes), you can use List::Compare, Array::Compare, etc, and make methods for comparing different parts of your objects (or classes). This allows you more control over the comparisons and allows them to be more granular should you have the need to dig deeper to see where the differences are.

Eric