Good day, Monks.

For as long as I've been writing Perl, I've felt there must be better ways to do code some of the things I usually code. I stand before you with my first question.

I'm having trouble with a simple data structure that seems to have gotten wildly out of control. It's a regular hash of keys and values, but two of the values are references to arrays.
%hash; $hash{'normal'} = "Some value" ; $hash{'list1} = [] ;
Then I use the list reference to add an unspecified number of hash references to my data structure.
push @{ $hash{'list1'} }, {keys=>values} ;

Now I can access this like so:
$foo = $hash{'list1}[0]{'key'} ;

I'm quite interested in how a PerlMonk would do this.
I'm rethinking my code base, and I need a structure like this to store data for my Tk programs. I'm currently assigning the address of the element to -textvariable options.
$widget{'foo'}=$mw->Entry(-textvariable => \$hash{'normal'}); # and for dynamicly created, repeating elements $widget{'bars'}[0]{'bar1'} = $mw->Entry( -textvariable => \$hash{'bars +'}[0]{'bar1'} ) ;

The problem gets really messy when I try to do things like:
#for storing past data (think 'back button') push @past_data, \%hash ;

I can't do this because %hash is full of references. It gives me a headache.

Any Ideas, Opinions, or Comments would be appreciated.
Bro. Doug The Inert.

In reply to Hashes of Arrays of Hashes (sometimes of Arrays) by Bro. Doug

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.