Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re^6: What makes an array sorted and a hash unsorted? (values)

by tye (Sage)
on Jun 05, 2009 at 17:28 UTC ( #768856=note: print w/replies, xml ) Need Help??

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

That orderedness of the hash only breaks when you use print @a for which there is no direct substitute on the hash side

values %h is the direct equivalent of @a. (And 0..$#a is a close equivalent to keys %h, but this equivalence isn't as close as the equivalence between values %h and @a.)

The order of the values returned is (indirectly) intentionally rather hard to predict, quite the opposite of many meanings of "sorted". But I'm not particularly interested in discussing how to split hairs in the definition of "sorted" or even "ordered" nor to split hairs in discussing whether the resulting definition(s) apply to Perl hashes. :)

- tye        

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://768856]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2017-12-17 06:48 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (462 votes). Check out past polls.