http://qs1969.pair.com?node_id=500532


in reply to Using references as hash keys

The whole concept of a hash is having a hashing function, a sort of check-sum. So an 'isEqual' function just doesn't enable making a hash.

You can emulate a hash using a tree if you provide an 'isLessThan' function. But you'd have to implement an ordered tree rather than just use Perl's hashes.

But just about any 'isEqual' function can be transformed into a 'getKey' function that returns a string such that isEqual($a,$b) iff getKey($a) eq getKey($b). And, you've surely realized, the result of getKey can be used as the key in a Perl hash.

- tye