Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^4: What makes an array sorted and a hash unsorted?

by ikegami (Patriarch)
on Jun 01, 2009 at 17:25 UTC ( [id://767331]=note: print w/replies, xml ) Need Help??


in reply to Re^3: What makes an array sorted and a hash unsorted?
in thread What makes an array sorted and a hash unsorted?

The point isn't that there is a way to sort them.

Of course you can. Just like array indexes are ordered in ascending numeric order, hash keys can be ordered in ascending lexical order.

You don't see people telling arrays that 5 sorts after 4. No, they change the key-value associations instead. You can do exactly the same thing with hashes. The difference is that people don't want to change the key-value associations for hashes.

Thus my conclusion: That hashes are unsorted isn't a property of hashes so much as of the way we use them.

  • Comment on Re^4: What makes an array sorted and a hash unsorted?

Log In?
Username:
Password:

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

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

    No recent polls found