in reply to hash sort problems
Once that's done, now partition the array into separate bins, which you can then use to print your whole set in whatever order you want. (Who knows, maybe next week you'll want the admins to be listed at the top instead of the bottom...) Pseudo-code example:@first_sort = (sort { .... } keys %my_server_hash );
I'm sure obfuskaters would love to try cramming it all into a single monster sort block, but you might find it more maintainable if your priorities are stated explicitly.for (@first_sort) { if ( &goes_first( $my_server_hash{$_} )) { push( @topset, $_ ); } elsif ( &goes_second( $my_server_hash{$_} )) { push( @set2, $_ ); # more steps if you want... } else { push( @lastset, $_ ); } } # now go through those subset arrays and print them in turn; # alpha-sorting is preserved within each subset...
|
|---|