Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Sorting an array of hashes

by oko1 (Deacon)
on Mar 26, 2008 at 16:46 UTC ( #676455=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    #!/usr/bin/perl -w
    use strict;
    ...
    
    my $count = 0;
    print join("\t", $count++, keys %$_), "\n" for sort mysort @AoH;
    
  2. or download this
    #!/usr/bin/perl -w
    use strict;
    ...
    my $count = 0;
    print join("\t", $count++, keys(%{$AoH[$_]})), "\n" for
        sort { keys(%{$AoH[$b]}) <=> keys(%{$AoH[$a]}) } 0 .. $#AoH;
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2020-08-13 21:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which rocket would you take to Mars?










    Results (75 votes). Check out past polls.

    Notices?