in reply to searching array of arrays

If you want to do an alphabetic search you can generally do a brute force approach (search every value) or set up an inverted index or tree, which would be really fast to search. An SQL database would probably do this for you so you could just use "LIKE" to search.

Regexes are also a way to do it; concatenate the whole thing together and then read off the rest of the entry.

Or a twist on the last suggestion, about using a hash. If you concatenate an incrementing number to the end of your keyword it will work even if you have keys with the same name. Just keep track of how many synonymous keys you have, using another hash (like synonyms{bob}==2 to tell you that $bighash{bob0} and $bighash{bob1} exist.

But these different strategies do kind of depend on why you are trying to do what you are doing. What is the actual project? Also I'd say this is very basic, homework level stuff (not to be insulting but to say that an inverted index is probably overkill and brute force (no hashes or anything, just the structure you have) is likely best) so probably you are not going to be able to use a database or a module. And you don't need to for this.

So don't worry about speed. If you can build a structure you can certainly take it apart. Make one subroutine for writing to the structure even if it is just a one liner, and another for reading from it, then treat them as black boxes (after testing them) and your main loop is very short. The best way to stay sane is to break up the problem into small pieces.