I have a few examples. I always use Tie::RefHash:
- A class (package) that needs to keep track of all its instances and look-up by instance when methods are called.
- An "object mapper" method in a package that takes two sets of objects from classes derived from that package and maps objects from the first to objects in the second. The resulting map is hash: first set objects are the keys; second set objects are the values.
- An XML template parser tool that, at one point, associates names to pieces of the XML that are stored as trees. Those trees are hash references. Later, some of the processing requires that given a tree we find its name. That reverse lookup hash uses the tree references as the keys and the names as the values.