Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Some advice regaring sorting and hashes

by markkawika (Monk)
on Jun 08, 2009 at 23:51 UTC ( [id://769720]=note: print w/replies, xml ) Need Help??


in reply to Some advice regaring sorting and hashes

Your code:

sort keys { $a <=> $b } %hash
Is incorrect. Assuming the groups really look like "AA01" and "GF02", and assuming you want them in alphabetical order, and assuming these are in the hash %hash, this is what you want:
sort { $a cmp $b } keys %hash

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (8)
As of 2024-09-18 10:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The PerlMonks site front end has:





    Results (24 votes). Check out past polls.

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.