As a general rule of thumb, the word "search" near the word "array" generally screams "wrong technology" at me.
- Arrays are for ordering
- Hashes are for searching
Recast your problem using hashes, and I think you'll get closer.
-- Randal L. Schwartz, Perl hacker