## ## USED WHEN YOU WANT TO TRAVERSE A LOGFILE AND ELIMINATE ANY DUPLICATE ENTRIES. ## #!/usr/bin/perl -w use strict; my %seen; my $logfile="/tmp/messages"; open(FILE, "<$logfile") or die "Unable to open $logfile :$!\n"; while(< FILE>) { my($domain,$ip,@rest) = split(/\s+/,$_); next if($seen{$ip}++); # NEXT IF IP IS SEEN print "ENTRY: $_\n"; } close(FILE); exit(0);