Since this is your first write-up on this site, I will assume you mean everyone somewhere else told you this. I believe this may have been a misunderstanding by you, them or likely both. You can get the keys of the hash returned to you in sorted order by any abitrary sorting method you want. The hash itself is still stored internally in its own order. This means you have to repeat the sort routine each time you want to view the hash sorted. There are modules that do the sorting for you under the covers given the appearance of a sorted hash.
I was able to sort / print the values in orderI hope you did not use the code you are showing here. You are using cmp when you should be using <=>. The difference is textual comparison versus numerical. Do you really want 2 coming after 10?
Welcome to the Monastery! - L~RIn reply to Re: Re: How to sort HASH?
by Limbic~Region
in thread How to sort HASH?
by iwanthome
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |