in reply to How do I find the position of an element in an array?

fundflow's suggestion above to use a hash might be a good idea, but what if the order of the elements in the array is important? You can't just use a hash, because hashes do not preserve any kind of order for their entries.

What you can use, however, is something like Tie::IxHash which gives you hashes that preserve the order of their entries and upon which you can do array-like operations.

Originally posted as a Categorized Answer.

  • Comment on Re: how do I find the position of an element in an unknown array