Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: adding key/value pairs to a hash.

by cbro (Pilgrim)
on Jun 20, 2003 at 13:58 UTC ( #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
Node Status?
node history
Node Type: note [id://267583]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2016-10-01 13:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (577 votes). Check out past polls.