Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: adding key/value pairs to a hash.

by cbro (Pilgrim)
on Jun 20, 2003 at 13:58 UTC ( [id://267583]=note: print w/replies, xml ) Need Help??


in reply to adding key/value pairs to a hash.

$key = 'd'; $value = 4; $hash{$key} = $value;

That's all you need to do.
Update:
Just wanted to say that hashes can be used for so many different things, internal (e.g. %ENV, %INC, %main) and external, in perl; you will want to master them. If you're not getting enough from the 'camel' book, try the Black Book and perldoc -q hash.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-03-28 21:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found