Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Matching values between two arrays of hashes.

by NetWallah (Abbot)
on Oct 31, 2012 at 19:16 UTC ( #1001735=note: print w/replies, xml ) Need Help??


in reply to Matching values between two arrays of hashes.

Is "location_id" numeric ?
If so, you can make lookups considerably faster by using an array:
my @filters_locations; $filters_locations[$_]=1 for map {$_->{location_id}} @filters_info;
If it is not numeric, make %filters_locations a hash.

Later, you can lookup the selected location by indexing into @filter_locations (or the hash).

             "By three methods we may learn wisdom: First, by reflection, which is noblest; Second, by imitation, which is easiest; and third by experience, which is the bitterest."           -Confucius

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1001735]
help
Chatterbox?
[stevieb]: Coding circles around Python devs, showing how unit tests should be done, enabling easy access to everything, learning basic C to wrap for direct hardware access... I am thankful.
[stevieb]: I'm in an appreciative mood. Thank you fellow Monks, for all I know, and for the knowledge which I can pass on

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2017-02-25 01:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (364 votes). Check out past polls.