Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

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

by QwertyD (Pilgrim)
on Apr 04, 2006 at 18:10 UTC ( [id://541205]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://541205]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-23 07:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found