My $0.02 is your code is too complex. Break it down into more than one hash with descriptive names. Why are you using Scalar::Util's refaddr, by the way, it's very unusual and will give different results on different platforms. Why not hash $self itself, won't you get different keys from its stringification?