http://qs1969.pair.com?node_id=90970

I log all incoming connections to my opennap server to a postgres database. I get about 625,000 connections per day, and I wanted to sort them by domain so that I could see visually in text where they were coming from. So I'll spare you the database calls. This, however, was a cool little hack to print the hosts out sorted by domain (rather than hostname). You can easily use File::Slurp to write the scalar obtained.

Credit to risacher for the sprintf right-justify.

my $noodle = join "$/", map { sprintf "%64s", $_ } ( sort { reverse($a +) cmp reverse($b) } (keys %hosts) );