Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: How do I dynamically create a hash table? (A straightforward Q, I know!)

by kharris (Initiate)
on Sep 25, 2002 at 18:51 UTC ( [id://200694]=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

Originally posted as a Categorized Answer.

  • Comment on Re: How do I dynamically create a hash table? (A straightforward Q, I know!)
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2026-01-12 23:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (118 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.