mt2k has asked for the wisdom of the Perl Monks concerning the following question:
Lets say that I have the following hash:
%hash = ( 'key1' => { 1 => { 'var' => 1, 1 => { 'name1' => 'value3', 'name2' => 'value2', 'name3' => 'value3' } }, 2 => { 'var' => 1, 1 => { 'name1' => 'value1', 'name2' => 'value2', 'name3' => 'value3' } }, } );
Now, how do I copy one part of this hash, such as the %hash{'key1'}{1} section??
Would it be done with one of these?:
I really have no clue... I have just begun last week working with complex hashes and arrays, and I'm just a little confused! %-|1. %copy = %hash{'key1'}{1} 2. %copy = %{$hash{'key1'}{1}}
|
---|
Replies are listed 'Best First'. | |
---|---|
(jeffa) Re: Copying multi-level hash
by jeffa (Bishop) on Mar 08, 2001 at 03:53 UTC | |
Re: Copying multi-level hash
by merlyn (Sage) on Mar 08, 2001 at 03:58 UTC | |
Re: Copying multi-level hash
by mt2k (Hermit) on Mar 08, 2001 at 03:59 UTC | |
by jeffa (Bishop) on Mar 08, 2001 at 04:05 UTC | |
by arturo (Vicar) on Mar 08, 2001 at 04:05 UTC | |
Re: Copying multi-level hash
by mt2k (Hermit) on Mar 08, 2001 at 04:15 UTC | |
by dvergin (Monsignor) on Mar 08, 2001 at 06:17 UTC |