in reply to Copying a hash to another hash problem
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.$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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Copying a hash to another hash problem
by Anonymous Monk on Oct 23, 2002 at 08:22 UTC | |
by Anonymous Monk on Nov 22, 2019 at 07:12 UTC |