Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: How do I dynamically create a hash table?

by kharris (Initiate)
on Sep 25, 2002 at 18:51 UTC ( [id://200695]=note: print w/replies, xml ) Need Help??


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

I just got done with this sort of thing. It looks like this.

my ($url, @rest, $url_rec, @url_keys); ($url, @rest)=split /\|/,$_; if($#rest == 3) # We're re-building. { @url_keys= qw{url_last_checked_return_code url_cat_id url_descriptio +n url_last_checked}; } if($#rest == 1) # We're adding. { @url_keys = qw{url_cat_id url_description}; } foreach my $key (@url_keys) { $url_rec->{$key} = pop @rest; }

I know that someone above adept-level could have done this more elegantly efficiently, but it works...so far. ;-)

kevin

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-19 10:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found