Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

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]
[choroba]: backslashing them should help
Discipulus ...Note that glob splits its arguments on whitespace..
[Discipulus]: oh it passed also some days ago iirc
[Discipulus]: thanks

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2018-03-20 12:03 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (250 votes). Check out past polls.