Re: Hashes and sorting.

[email protected] (Robert Spier) Mon, 25 Aug 2008 00:13:12 -0700
Newsgroups perl.perlfaq.workers
Message-ID <[email protected]>
This isn't the mailing list you're looking for.    It's intended for
discussion related to the perlfaq.

Try:
 http://learn.perl.org/
 http://lists.cpan.org/showlist.cgi?name=beginners
 http://lists.cpan.org/showlist.cgi?name=beginners-cgi

-R


Chuck Cochems wrote:
> 
> 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.
> 
>