I wish I could claim that I came up with the "build it in reverse" technique myself. I saw it first in a great book published by O'Reilly & Associates, "Mastering Algorithms with Perl". The book discusses (among many other topics) building linked lists, and one method is surprisingly similar to the solution I provided to your problem. Your situation was a little different, but being familiar with the Algorithms book provided me with the basic concept. I highly recommend the book.
You can also learn a great deal about complex datastructures and Perl's references from the following POD's:
Happy hunting...
Dave
In reply to Re^2: Creating Hash of hash of hash dynamically
by davido
in thread Creating Hash of hash of hash dynamically
by rjc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |