Grouping perl foreach values

Richard Cottrill richard_c at
Tue Jul 9 20:45:41 EST 2002

> From: linux-admin at [mailto:linux-admin at]On
> Behalf Of Damien Elmes

> Not really trivial. You need to use either references to 3
> element lists, or
> a variant on what Alex suggested, a list of hashes references.
> Regards,
> --
> Damien Elmes

I'll chip in now that this looks more or less settled.

After making some truly horrible Perl code, while figuring out what worked
best for me, I came to the conclusion that structuring the data made life a
LOT easier. The ugliness of Perl only became apparent when the data
structures became deeply nested. Once I wrote a data structure sufficiently
deep that, to access it, I could either use a dozen single use variables or
one line and a huge comment. I decided that the "one line, huge comment"
approach was 'better' (but just barely).

Michael, I'd go for a list of hashes if I were in your shoes. You could make
the argument list a Perl list too if you're going to fiddle with them much
more. I really like hashes (with nice names); they make the code infinitely
more readable. Hashes using vague IDs as the index don't do so much for me

Does Perl support sparse arrays well? Anyone?


More information about the linux mailing list