The article you'll want to read is perllol. The primary issue you are having is that multi-level data structures are formed using the flat data structures combined with references to other data structures - Perl just does it explicitly. The syntax you want in order to create your hash is probably:

%Data_Hash = ( Call_Hash => { TST_IDS_Large_1 =>2.9E-12, TST_IDS_Large_2 =>1.85E-12, TST_IDS_Small_1 =>1.86E-9, TST_IDS_Small_2 =>2.83E-9, }, OPT_VGS_1 =>0, OPT_VGS_2 =>0.02, );

{key1 => val1, key2 => val2} returns a scalar pointer to a hash with the key value pairs listed. In order to interact with it, your code would read:

@idlarge = ($Data_Hash{Call_Hash}{"TST_" . "IDS_Large_1"}, $Data_Hash{Call_Hash}{"TST_" . "IDS_Large_2"}, ...)

or

@idlarge = ($Data_Hash{Call_Hash}->{"TST_" . "IDS_Large_1"}, $Data_Hash{Call_Hash}{"TST_" . "IDS_Large_2"}, ...)

since consecutive indices contain an implicit deference.

Update: I misunderstood the spec. Assuming that your access methods are correct, you actually want two completely separate hashes. The values of %Call_Hash are being used as keys in the %Data_Hash. The data structures you want are given by:

%Data_Hash = ( OPT_VGS_1 =>0, OPT_VGS_2 =>0.02, ); %Call_Hash = ( TST_IDS_Large_1 =>2.9E-12, TST_IDS_Large_2 =>1.85E-12, TST_IDS_Small_1 =>1.86E-9, TST_IDS_Small_2 =>2.83E-9, );

except that the values of %Call_Hash should correspond to keys in %Data_Hash.


In reply to Re: Hash Within A Hash by kennethk
in thread Hash Within A Hash by forgedascendant

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.