Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Creating SELECT-like look-up tables as hashes

by choroba (Abbot)
on Nov 29, 2013 at 14:23 UTC ( #1064959=note: print w/ replies, xml ) Need Help??


in reply to Creating SELECT-like look-up tables as hashes

No need to check for existence, Perl has autovivification:

push @{ $lookup_fur_and_legs{$key} }, $ref;

It will create the new array ref if needed.

Update:Also, as $id is not used, you can change the loop to

for my $ref (values %lookup_id) {
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re: Creating SELECT-like look-up tables as hashes
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2014-07-28 21:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (209 votes), past polls