Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Copying multi-level hash

by mt2k (Hermit)
on Mar 08, 2001 at 03:59 UTC ( [id://62873]=note: print w/replies, xml ) Need Help??


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'.
(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--
    
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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://62873]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2024-04-18 12:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found