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

well, i need to do this to feed a mailinglist into Mail::Bulkmail -- which can send emails within 1 envelope to each machine... so the machinename.domainname.tld works in this case anyways, i noticed a way to make it even slightly faster (about 8%)...
%domains = {}; for (@emails){ @email = split /@/, $_; if (!$domains{$email[1]}){ $domains{$email[1]} = []; } push @{ $domains{$email[1]} }, $email[0]; } foreach $domain (sort keys %domains) { foreach $recipient ( @{ $domains{$domain} } ) { push @sorted, ( $recipient . "@" . $domain ); } }