Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Finding Previous and Next in a HASH

by FouRPlaY (Monk)
on Dec 12, 2000 at 05:07 UTC ( #46197=note: print w/replies, xml ) Need Help??

in reply to Finding Previous and Next in a HASH

I forget where I read it - whether it was on this site or in a Perl book - but someone said/wrote that if you find yourself wishing arrays were associative or hashes were ordered, you're using the wrong tool.

It seems to me that you sould start off with an array and not use a hash at all.

Learning Perl or Going To die() Trying
  • Comment on Re: Finding Previous and Next in a HASH

Replies are listed 'Best First'.
Re: Re: Finding Previous and Next in a HASH
by myocom (Deacon) on Dec 12, 2000 at 05:17 UTC

    Sometimes you end up with conflicting wishes, though. For the problem I was having earlier, I had a case of requiring unique keys and also wanting to index into the hash (or rather, the keys of the hash). In my case, at least, the fact that hash keys are by definition unique outweighed my desire for ordered hashes. Otherwise, you're right, I would've used an array. :-)

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2022-12-03 09:18 GMT
Find Nodes?
    Voting Booth?

    No recent polls found