|P is for Practical|
Dating a Structureby hacker (Priest)
|on Jun 30, 2007 at 21:50 UTC||Need Help??|
hacker has asked for the
wisdom of the Perl Monks concerning the following question:
Thanks to the patient mentoring of Anno, bart, and clinton, I'm making this post to embiggen my Perl skills.
I've got a project that I'm building to mirror an enormous amount of data in several dozen languages. Right now I have 3 separate arrays:
In each of these languages, I build a structure that looks like:
Within each of those projects, I fetch the data for them:
The way I'm doing this is very "array-based":
I've always had trouble grokking hashes in Perl, many people know that... but it looks like I have to bite the bullet here and dive into an HoHoA to create this structure.
My question is... can I create a "completely anonymous hash", which can be built dynamically from the values in each of the arrays above? I'd actually like to add more granular detail here, without adding more and more arrays (further increasing that nesting)... something like:
The goal is to be able to fetch each of the @targets within each of the @projects, for each @lang supported. If I want to back up another set of targets in another language, I should just be able to add another language to the list and have it inherit the rest of the members of the "anonymous hash" (if I'm using the vernacular correctly).
Is this possible? Is there another way to represent this structure without more levels of array nesting, and without duplicating manually-typed entries in a growing sub?