in reply to check if an element exists in array

You can build a hash, but perhaps you need to store arrays as the hash values, not the strings directly.

Or you can build an array and a hash, and preserve multiple names only in the array.

Or of course you can just iterate over the array to find the names, but that's very inefficient, especially if you do it repeatedly.

  • Comment on Re: check if an element exists in array