Your first foreach says "Iterate over every key in the hash, in order". Your second one says the same thing. The hash itself is not changed.
I'm also unsure what you mean by a "sorted hash" - if you mean, the next time you do a foreach on it's keys, they come out in order, nope. hashes are always unsorted - that is, the ordering is dicatated by need to access values quickly. If you want a "sorted hash", the nearest thing I can think of is to do your foreach, push the values onto an array and then do a foreach on the array.
In reply to Re: sort mechanism
by kal
in thread sort mechanism
by readey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |