|Welcome to the Monastery|
Massive expansion of a hash of arrays?by Amblikai (Sexton)
|on Jul 17, 2014 at 20:42 UTC||Need Help??|
Amblikai has asked for the
wisdom of the Perl Monks concerning the following question:
Hi Monks! I've got a bit of a question which i'm hoping could make one of my scripts a bit more concise
Essentially i have a hash of arrays (massively simplified):
And i need to expand it out to look like this:
So each key is a field of data With various values and i need to expand out a single line for each combination given. As i said, this i massively simplified and i actually have ~15 'keys' and each can have about 11-12 values in it's array.
I'm currently doing it the obvious way of:
Which is fine but everytime i add a new field it get a bit unwieldy. I have "foreach" statements running off the side of the monitor and onto my wall!! Help!
Apologies if there's any mistakes in the above. It's been a long day. Any help appreciated as ever!