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

thank you all..

i did some testing.. and my first idea seems to be the fastest (though i haven't tried the newer posts yet). i've created dummy lists of 100,1000,...1,000,000 emails, and this seems to take half as much time as the first reply
$i = 0; for (@emails){ @email = split /@/, $_; push @{ $domains{$email[1]} }, $i; $prefixes[$i] = $email[0]; $i++; } foreach $key (sort keys %domains) { foreach ( @{ $domains{$key} } ) { push @sortedEmails, ( $prefixes[$_] . "@" . $key ); } }