I have a list of 1500 things.
They're arrays. The reason they're not in a hash is because there are duplicate keys. I need to locate these duplicates and act on them in some way.
My first loop through the file creates a hash keyed on the potentially duplicate value. I add one to each hash member.
When I'm done, I then iterate over the hash and use the keys with values greater than one to create a list of duplicate items.
I then iterate through the original file and if the current item is in the list of duplicates, I execute some logic to decide what to do with it.
As you can imagine, I wanted to avoid (for performance reasons) iterating over 1500 items (each iteration involves splitting a string and performing a regex match and making a decision on it) for, potentially, 1500 items.
And the 1500 items may actually grow :-)