in reply to How do you sort keys of a hash in descending order and print 3 per line?
my %accounts = ( tom => "BigApple", tom2 => "BigApple2", tom3 => "BigApple3", tom4 => "BigApple4", tom5 => "BigApple5", tom6 => "BigApple6", tom7 => "BigApple7", ); # sort the users in descending order my $counter = 1; for my $userID (reverse sort keys %accounts) { print "$userID\t"; print "\n" if $counter++ % 3 == 0; } tom7 tom6 tom5 tom4 tom3 tom2 tom
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How do you sort keys of a hash in descending order and print 3 per line?
by GrandFather (Saint) on Mar 16, 2016 at 05:39 UTC | |
|
Re^2: How do you sort keys of a hash in descending order and print 3 per line?
by MikeyG (Novice) on Mar 16, 2016 at 03:32 UTC | |
by AnomalousMonk (Archbishop) on Mar 16, 2016 at 03:47 UTC | |
by MikeyG (Novice) on Mar 16, 2016 at 03:52 UTC | |
by AnomalousMonk (Archbishop) on Mar 16, 2016 at 04:03 UTC | |
by Marshall (Canon) on Mar 17, 2016 at 12:03 UTC | |
by 1nickt (Canon) on Mar 16, 2016 at 03:49 UTC |