I've never seen any particular documentation, but picked up in an example when looking for a hash of hashes. Hashes of arrays are useful for columnar data, but hashes of hashes allow you to keep a well ordered structure of data and pass it around like a football in your code if needed.
As an example, say you want a hash of contacts data. Calling if exists on $contacts{$last}{$first} will tell you if you have that person in the contacts hash, so you can then look for other pertinent details. With the hash of hashes you have a hash for each person like
$contacts{$last}{$first}{HomePhone}=
$contacts{$last}{$first}{WorkPhone}=
$contacts{$last}{$first}{HomeEmail}=
$contacts{$last}{$first}{WorkEmail}=
or any of the several ways to assign data to a hash value
Accessing and assigning values can be a bit of a mind warp, but once you understand it, it is very useful and compact.
see http://docstore.mik.ua/orelly/perl/prog3/ch09_04.htm for a bit more.
I've been using such since 5.8 but am not sure how long it's been available.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.