From the shell, it's a snap: perl -ple'$_=join".",reverse split/\./' reverse the domain components (mail.example.org becomes org.example.mail). This can then be piped to another filter (e.g.sort) and then the same filter can be run again to undo the reversal.
It's even easier if the command is wrapped up in an alias. (And yes, I know about "Useless use of cat(1)". I'm using it here to show the symmetry of the munging/demunging).