All the posts above are good, and to the point. I'll add my .02 gold as I didn't see a post which showed you how to go about doing exactly what you were doing, the way you were doing it.. (:P say that 10 times fast... No! not 'that' :) )
$frameno = "1"; $drawerno = "12"; $tempno = "44"; # assignment $framearray->{$frameno}{$drawerno} = $tempno; # reassignment %new_hash = %{$framearray}; # or only particular hashes thereof %some_frame = %{ $framearray->{$frameno} }; # Now if we loop through %some_frame our keys are # $drawerno and our values are the values assigned above while ( ($drawer,$val) = each(%some_frame) ) { print "$drawer -> $val\n"; } # would print # 12 -> 44
People have stated the deal with references so I'll leave that alone. I'm simply showing how to get the data the way you were trying.

It's my personal belief that even if I'm not necessarily doing it the "right way", I always like to be able to get it done. That way I know that at the very least I grasp the concept of whats going on. Then I'll find the module that does it appropriately. This way I learn, and implement cleanly, as opposed to getting stuck at some point, and not be able to proceed due to the fact that I may not have access to CPAN right now, and I need this done ASAP.

Cheers and happy hacking

/* And the Creator, against his better judgement, wrote man.c */

In reply to Re: Copying a hash to another hash problem by l2kashe
in thread Copying a hash to another hash problem 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.