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

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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://768856]
help
Chatterbox?
[MidLifeXis]: Nothing like encouraging the success of a rollout by neutering your current support structure without a reasonable staffed and trained replacement structure.
[MidLifeXis]: Speaking of which, anyone know of Perl positions in the MKE area (or slightly west)?
[Corion]: MidLifeXis: Oh, enjoying the show from the sidelines I see...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (11)
As of 2017-03-23 12:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (286 votes). Check out past polls.