Hashes and sorting.
[email protected] (Chuck Cochems) Wed, 20 Aug 2008 13:45:04 -0700
| Newsgroups | perl.perlfaq.workers |
|---|---|
| Organization | Dis |
| Message-ID | <[email protected]> |
I need to be able to sort a hash, then pass the sorted hash as a reference. You see, there's this scrolling_list thing in CGI.pm to use human readable values in a dropdown, you need to pass the name value pairs as a hash reference. Of course, when you do this, the hash is in random order. i want to sort this hash once, and then pass it sorted. This should be simple, right? I know how to print a sorted list of the keys, but i can't pass a sorted list of pairs to CGI.pm, because it wants the hash reference itself, which doesn't actually get sorted by creating the list of keys.