I have a hash, %userdatefile which is 3 levels deep, containing one record whose value is the number of times that a user requested a file on a certain date, e.g., it was created via:
++$userdatefile{$USER}{$DATE}{$FILE}
Now the idea is that it would be nice to reorder the hash so that I could make the first key the date instead. I could manually do this, creating another hash, accessible ala:
$dateuserfile{$DATE}{$USER}{$FILE}
but it seems cumbersome and tedious to create new hashes for each dimensional rework of the original dataset.

Can anyone recommend a package/means to have one nested hash yet be able to "query" it for multiple views?

Gracias, pawn


In reply to creating multiple views of a hash by reordering its key and values by princepawn

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.