Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: How to Sort a Hash According to the Keys in the Hash

by Discipulus (Canon)
on Dec 02, 2015 at 21:32 UTC ( [id://1149227]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @order = qw(Sports Books Places);
    my %hash;
    ...
    
    #retrieve them in the desired @order
    print map { "$_ => ".(join ',',@{$hash{$_}})."\n" } @order ;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-03-29 11:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found