the simplest way is to use uniq (see 'man uniq') If you really want to do this in Perl or if this is really your homework *grin* then:
--perlplexer#assuming that your file has only one email address per line my %emails = (); open FH, "<emails.dat" or die "error: $!"; $emails{$_}++ while (<FH>); close FH; open FH, ">new_emails.dat" or die "error: $!"; print FH $_ while ($_ = each(%emails)); close FH;
In reply to Re: Files
by perlplexer
in thread Removing duplicate lines from files (was 'Files')
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |