Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: (nrd) Sorting an array

by newrisedesigns (Curate)
on Feb 15, 2003 at 00:29 UTC ( #235465=note: print w/replies, xml ) Need Help??

in reply to Sorting an array

use CGI; %month_array = ( '01' => "Jan", '02' => "Feb", '03' => "Mar", '04' => "Apr", '05' => "May", '06' => "June", '07' => "July", '08' => "Aug", '09' => "Sep", '10' => "Oct", '11' => "Nov", '12' => "Dec" ); print CGI::popup_menu(-name=>"month_array", -values=>[sort {$a cmp $b} keys %month_array], -labels=>\%month_array, -default=>$mon, -class=>"formfield")

John J Reiser

Replies are listed 'Best First'.
Re: Re: (nrd) Sorting an array
by powerhouse (Friar) on Feb 15, 2003 at 00:38 UTC
    Thank you. However, it is still putting it like this:

    value = 1 label = Jan
    ..10 ..Oct
    ..11 ..Nov
    ..12 ..Dec
    ..2 ..Feb
    ..3 ..Mar

    Here is what I put:

    popup_menu(-name=>"month_array", -values=>[sort {$a cmp $b} keys %month_array], -labels=>\%month_array, -default=>$mon, -class=>"formfield")

    Did I do it wrong?
    OOPS. I see, I did not add the 0 in front of the others :o)


      No problem. Glad to help!

      If you absolutely can't have the leading zero, do what the good monk pfaut did below.

      John J Reiser

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://235465]
[Discipulus]: [OT] if i have an svg image (a map of italian provinces) like this one in which way i need to interact with it to have a geochart?
[Corion]: I haven't found a good way to plot stuff into country maps... Maybe one of the demos of D3.js has something usable?
[Discipulus]: i need to use css to get and colorize various different IDs?
[Corion]: I haven't used it, but http://datamaps. looks promising

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (13)
As of 2017-03-23 09:18 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (285 votes). Check out past polls.