Too many nested loops? Sounds like you need recursion!
In reply to Re: Massive expansion of a hash of arrays? by Anonymous Monk in thread Massive expansion of a hash of arrays? by Amblikai