Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: how do I use a hash of hashes reference in a function ?

by merlyn (Sage)
on Sep 22, 2000 at 21:53 UTC ( [id://33666]=note: print w/replies, xml ) Need Help??


in reply to how do I use a hash of hashes reference in a function ?

$hashref{name}={data1=>"moredata",};
Wrong syntax for adding to a hash. Use this:
$hashref{name}{data1} = "moredata";

Replies are listed 'Best First'.
RE: Answer: how do I use a hash of hashes reference in a function ?
by Fastolfe (Vicar) on Sep 22, 2000 at 23:45 UTC
    Just for clarification (for the original poster), your syntax:
    $hashref{name} = { data1 => "moredata" };
    *replaces* the reference in $hashref{name} with a new one, composed of your data1 => "moredata" hash. That's why it won't work. merlyn is correct in that if you wish to modify the hash referenced by $hashref{name} you don't do that by setting $hashref{name}, you modify it as if it were a hash: $hashref{key}{subkey} = $xyz;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-04-18 07:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found