I am stumped populating a hash of hashes which consists of complex data. I am parsing a file which consists of multiple records in a custom format. I only want to capture 5 fields. Three fields are simple which I populate as key=> value pairs (i.e. $hash{$counter}{'variable'} = variable). The other two fields are repeatable (i.e. http://www.google.com, http://www.greenpeace.com, http://www.perl.com, etc). So I am pushing these fields as push @{$fields},$url. The problem I am experiencing is that when I use this strategy to pupulate my hoh, the array is counted rather than stored as a reference value. I use $hash{$counter}{'url'} = push @{$fields},$url. I tried using eval {push @{$fields},$url}, but same results. I am sure I am missing something very simple here. Can you folks guide me in the right direction? What's the best way to capture the value of an array reference in a hash of hash key? Thanks for all your help. Still trying to sort this out...

In reply to Complex Hash of Hashes Data Structure by Anonymous Monk

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.