If I understand your question correctly, you can create a complex structure (i.e., hash of hashrefs, of hashrefs, etc.) and reference a particular object (array, hash, perl object, etc.) more than one place within the structure (i.e., multiple dependencies refer to it). Perl will not become confused by this, as evidenced by the following.

my @test = qw( a list of words ); my %test = ( keyword => 1, value => 2) my %outer = ( hash => \%test, array => \@test); $outer{another_hash}=\%test; # add same value with another key

When this is dumped within the Perl debugger, Perl recognizes that it has already encountered the hashref and says so:

DB<1> x \%outer 0 HASH(0xc881d4) 'another_hash' => HASH(0xc858c0) 'keyword' => 1 'value' => 2 'array' => ARRAY(0xc85950) 0 'a' 1 'list' 2 'of' 3 'words' 'hash' => HASH(0xc858c0) -> REUSED_ADDRESS DB<1>

Since it eschews C-style pointers, Perl manages its own heap quite well, and it is *VERY* difficult to screw up. As long as the OS has memory to give, a perl process can use as much as it needs (in my humble experience). I've seen perl processes using upwards of 1Gb of memory.

Of course, it helps if you design your structures to be as efficient as possible, as with any language.

dmm

You can give a man a fish and feed him for a day ...
Or, you can
teach him to fish and feed him for a lifetime

In reply to Re: Memory allocation by dmmiller2k
in thread Memory allocation 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.