There is a deprecated data structure called a pseudohash which is ideal for this, whatever its other disadvantages. To pseudohashify your AoA:
my $AoA = [ [1..3], [7..9], [3..5] ];
my $row_labels = { foo => 1, bar => 2, baz => 3 };
my $col_labels = { do => 1, re => 2, mi => 3 };
unshift @$_, $col_labels for @$AoA;
unshift @$AoA, $row_labels;
print $AoA->{'foo'}{'re'}, $/;
print $AoA->[1][2], $/;
This is not well-regarded these days, but it will do the job. Don't rely on it being available in a year or two.
After Compline,
Zaxo
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.