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.