|Perl: the Markov chain saw|
|( #3333=superdoc: print w/replies, xml )||Need Help??|
I'm saying there's no difference between hash and arrays except in the order they choose to return their values.I don't think you're really contending that. It's obviously not true as stated. They are syntactically, functionally, and internally quite different. At a very abstract level, they're notionally about the same: collections of scalars that are indexable. If, by "return their values" you include the notion of having a "first (etc.) element", so that stacks and queues can be implemented, then I suppose that's the major difference (apart from being able to index a hash by string). So I'm still a bit unclear on your point. I kind of get it, but not really.
I agree that people would still ask how to sort hashes, just as they currently ask how to sort arrays or lists. When they ask how to sort something, they indicate that they know they need to sort it.
When people say (or hint that they think) that they have a hash whose elements are in some particular order, the answer is "hashes aren't ordered". It is a misconception people have about hashes. Once that misconception has been addressed, the question of how to solve their problem can be addressed. I don't think anyone has suggested that "hashes aren't ordered" is all anybody needs to know about them.
If hashes had an intrinsic order, but people operated as if they had a different intrinsic order, we'd be telling them "hashes aren't ordered that way, they're ordered this way." Then we'd still have the issue of whatever particular thing the user is trying to accomplish. So the response wouldn't be all that different.
Caution: Contents may have been coded under pressure.
In reply to Re^9: What makes an array sorted and a hash unsorted?
by Roy Johnson