in reply to Hash of Array references

I prefer to think of data-structures like this as complex ”records” that might be “indexed” in a number of different ways.   For example, define a single (anonymous) hashref to be your “record,” with a key for each “field” and a value that consists, as the case may be, either of a scalar or an array of values.   Your basic data store is an array of those hashrefs.

Then, for all of the ways that I need to locate those records ... well, here you have a pragmatic choice.

One way is to use additional hashes as indexes:   the keys are values being sought, and the values are either a single scalars (references are scalars), or an array of references.   You look up the key, then you have a reference to the record(s) that match that key.

But, pragmatically, you can also often just-as-well use the grep function to loop through the entire array, brute-force.   It is memory, after all, albeit virtual, but if you have “gobs of RAM,” it’s usually fast-enough just to search for whatever you want each time.

Still, when it comes down to locating “a record,” I do eventually want to come to that:   a single data-structure (a hashref), which, by itself and self-contained, contains all of whatever I need to know about that Thing.