in reply to Copying multi-level hash

Oh, and also, now if I wanted to place the %copy hash back in the big one (just theoretically), how would I do that?

1. %hash{'key1'}{1} = %{$copy}; 2. %hash{'key1'}{1} = %copy; 3. $hash{'key1'}{1} = %copy; 4. %{$hash{'key1'}{1}} = %copy; 5. %{$hash{'key1'}{1}} = %{$copy};
Though I somehow think none of those look right...

Replies are listed 'Best First'.
Re: Re: Copying multi-level hash
by arturo (Vicar) on Mar 08, 2001 at 04:05 UTC

    Remember above all : a reference is a scalar value, so reference it as you would a string (e.g.) -- as long as you remember it's pointing to something, instead of containing the value you want. Since you want to set it to a hashref:

    So:

    $hash{key1}{1} = \%copy;

    should do ya.

    Philosophy can be made out of anything. Or less -- Jerry A. Fodor

(jeffa) Re: Re: Copying multi-level hash
by jeffa (Bishop) on Mar 08, 2001 at 04:05 UTC
    #3 was close
    $hash{key1}{1} = \%copy;

    Jeff

    R-R-R--R-R-R--R-R-R--R-R-R--R-R-R--
    L-L--L-L--L-L--L-L--L-L--L-L--L-L--