I have a hash in which order data is recorded from the example below:

Delivery information

First name: Job Last name: Clufer Company: WMRMC Street: 133 s. mountain ave City: springerville State: Arizona Zip: 85955 Country: United States of America Phone: 928-323-7664 

Additional information

 IP: 74.44.236.92 Language:en 

I need this data to be associated with the category to which they relate, that is, by key for example additional information I can find the key
IP: and learn its meaning. How to organize it?

    1 answer 1

    It is possible so:

    • create an array of hashes (of these cards)
    • create a hash of rubricators whose elements are array hashes, whose elements are the sequence numbers from the previous paragraph

    Then you can use something like this:

     $array = $hash['Country']['USA'] & $hash['Zip']['85955'] 

    This will give an array of indices of those "cards" that simultaneously belong to the USA and have a ZIP code equal to 85955.

    However, you can read about operations with arrays separately, for example, here .