Web Development

General discussion


Perl: Store multiple values per hash key

By MaryWeilage Editor ·
The June 10 Perl e-newsletter describes how to store multiple values per hash entry. Will you use the technique described in this tip to store multiple values in a hash array? Do you know of a better technique that will accomplish the same thing? Please share your thoughts.

If you aren't already subscribed to the Perl e-newsletter, visit our e-newsletter subcenter to sign up for this free TechMail today:

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

multiple values per hash element

by twirdlock In reply to Perl: Store multiple valu ...

I use hashes extensively in PERL programs to keep track of the US Postal Serives' 40,000+ POS (point of service) computers. Some common ways are:

1. hash keyed to machine name with the value a string of comma-separated site identification values(address, district, etc). After collecting data from the POS systems, get the appropriate ID info and append it to the record so the resulting .CSV data file tels users where the data caame from.

2. hash of hashes or hash of arrays to contain various bits of data about a system. I use this for analysis and report generation where I cycle through systems and compare data elements to determine the state of the system and what, if anything, needs to be done to it.

Related Discussions

Related Forums