hi,

well this is probably the obvious one but i'm stuck and i don't now how to get out from it. i have a subroutine (obj. method) in a class that creates two hashes which i want to pass into my main script(program).

package Tool; use strict; sub new { # construct... } sub _init{ # initialise... } sub create { my $self = @_; bla bla... create %hash1 , %hash2 ... my @vi = qw(\%hash1 \%hash2); return @vi; } ############## main program ################# use strict; use lib "./temp" use Tool; ... my $tree = Tool->new(); my @array = $tree->create(); #i did the separation of variables on purpose ... my $first = $array[0]; my $second = $array[1]; my %hashfirst = %$first; my %hashsecond = %$second; ######## and now it dumps %hashfirst on <b>" print Dumper(%hashfirst)"</b>; but it doesn't want to dump the second one (%hashsecond)...
also if i pass the hashes directly it uses 3x the memory , but in this way only 80MB RAM. so my question is why does this happen?

robert


In reply to passing the reference from a class. by baxy77bax

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.