In addition to
rhesa's recommendation - Your "%hash" most likely does not look the way you expect it to - There are no usable Keys, and the structure does not make logial sense for what you say you need. Here is what your structure looks like:
$VAR1 = {
'ARRAY(0x19333b0)' => [
'baz',
5
],
'ARRAY(0x350c8)' => [
'bar',
7
]
};
Note that it has converted your Arrayref [
"foo",1] into a KEY, which is probably not what you want. In any case, a hash-type structure does not seem to be called for , based on your description. I'd sugges an AoA.
Update: AoA Recommended:
my @Index_Is_The_Weight=(
[], # Zero weight - no items
["foo"], # Only one item has weight ONE
[], # No items in weight 2
["bar"], # Three
([]) x 5, # Five empty items
["quux"]
);
"A closed mouth gathers no feet." --Unknown
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.