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

Re: Re: To Hash or Not to Hash??

by gwadej (Chaplain)
on Dec 02, 2003 at 16:48 UTC ( [id://311685]=note: print w/replies, xml ) Need Help??


in reply to Re: To Hash or Not to Hash??
in thread To Hash or Not to Hash??

As a quick side note, an idiom for inverting a hash like that is

%ours = reverse %ours;

This may not be the right choice if the hash is very large because of the extra memory used by the temporary list. But in this case, it looks like it would be okay.

See recipe 5.8 in the Perl Cookbook.

Obviously, both of our solutions will have problems if the values are not unique.

G. Wade

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-03-29 12:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found