|Don't ask to ask, just ask|
Re^5: variable as hash nameby Tux (Abbot)
|on Dec 08, 2012 at 09:58 UTC||Need Help??|
That is not a reason to want to do it the way it is in your mind right now.
It is rather funny to see this topic, as it is almost exactly the problem that dragged me into perl development in the first place. I almost did the same, and once everything "worked", problems started to arise.
The solution, as others already stated in a more or less explicit way, is to make ONE (and only ONE) global (or at least in a scope as limited as possible) variable that contains all your hashes that you do not yet know about.
Note that the main difference is that you'd need to initialize as anonymous hashes instead of lists, so
Of course you can also use a ref as top-level, so the reference stands out better (for any value of better):
One *huge* advantage with using a scalar reference is that you can easily (and safe and fast) pass that reference around to other parts of your program and limit the scope.
Aut-vivivication is your friend!
Enjoy, Have FUN! H.Merijn