in reply to How do I alphabetize a list of email addresses by domain?

Without trying to optimize anything, here's an approach using Mail::Address:

# @emails exists already use Mail::Address; my @sorted_by_domain_then_user = map { $_-> format } sort { $a->host cmp $b->host or $a->user cmp $b->user } map {Mail::Address->parse($_)} @emails;
This may not be exactly what you want, but should be close.

After Compline,
Zaxo