Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: How do I dynamically create a hash table?

by tedv (Pilgrim)
on Oct 27, 2000 at 20:54 UTC ( [id://38849]=note: print w/replies, xml ) Need Help??


in reply to How do I dynamically create a hash table?

use strict; my %hash = (); foreach $value (@some_list) { my $key = make_some_key($value); $hash{$key} = $value; }

In other words, just assign a new key/value pair using $hash{$key} = $value. It's the logical compliment of how you'd access a hash value: $value = $hash{$key}

-Ted

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-24 22:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found