Only if you're going to repeat the operation a few times
Building a hash is slower than scanning the array.
Accessing a hash many times is faster than scanning the array many times.
At some fairly small fixed number, building the hash is worthwhile. That number varies with OS, version of Perl, and what parameters Perl was built with. I tested it once at 7, but that is probably not true any more.
Cheers,
Ben
I have come to believe that idealism without discipline is a quick road to disaster, while discipline without idealism is pointless. -- Aaron Ward (my brother)