#!/usr/bin/perl -w use strict; my $in_file = 'email.log'; my $out_file = 'new_email.log'; # Note that this is written to a *different* file # so we can go back if we screw up # If that's not good, backup the email log. open IN, "< $in_file" or die "Can't open $in_file for reading: $!"; open OUT, "> $out_file" or die "Can't open $out_file for writing: $!"; my %address; while () { print OUT, $_ if ! $address{ $_ }++; } close OUT or die "Can't close $out_file: $!" close IN or die "Can't close $in_file: $!";