in reply to Re^2: Help with removing duplicates in array
in thread Help with removing duplicates in array

And what do you get? Does it run w/o warnings? Do you still get duplicates? Are you aware that you only remove duplicates from the same $file but that there could be duplicates across? Change your printing to

print $fh "$file:$emails\n"; # write the emails to file

to check from which file your emails are retrieved from.