in reply to OO search in objects
If your program most-commonly looks for objects by “name,” then putting the objects into a hash rather than array might be most effective. The each() iterator can be used to walk through it, or you can use keys to obtain an array of keys. This will only (easily ...) work if the names are unique.
You can also have it both ways. The “array of objects” actually contains references to those objects (as does the hash above), and it’s perfectly find to have more-than-one reference to the same thing. This is directly analogous to an SQL database with its multiple “indexes.” It works great, with only one small catch: you must know that this is what you’ve done. If you want to dispose of an object, you do so by eliminating all references to it ... from the array, and also from the hash.