Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Re: Re: Answer: How do I order a hash for use as a %label list in cgi.pm?

by filmo (Scribe)
on Mar 22, 2001 at 05:20 UTC ( [id://66208]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Answer: How do I order a hash for use as a %label list in cgi.pm?
in thread How do I order a hash for use as a %label list in cgi.pm?

Thanks, definity one of those "duh" things that seems so obvious after you hear the right answer.

But, what if the values of the list are some unique randomly generated user id such as "9322042" and the Labels are supposed to be "Arnold", "Bob", "Clark", etc. How does one get the labels that appear in the menu to be alphabetical even thought the values are not similarly ordered.
--
Filmo the Klown

  • Comment on Re: Re: Re: Answer: How do I order a hash for use as a %label list in cgi.pm?

Replies are listed 'Best First'.
Re: Re: Re: Re: Answer: How do I order a hash for use as a %label list in cgi.pm?
by chipmunk (Parson) on Mar 22, 2001 at 10:23 UTC
    Sort the keys by comparing the values: my @values = sort { $labels{$a} cmp $labels{$b} } keys %labels;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://66208]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-19 22:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found