Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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.


Comment on Re: adding key/value pairs to a hash.
Select or Download Code

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 browsing the Monastery: (3)
As of 2015-07-06 05:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls