use File::Compare; my $F1="version1.txt"; my $F2="count.txt"; my $F3="differ.txt"; if(compare($F1,$F2)==0)#the addition of the USE line is important for this function to work. {print"they are the same";} elsif(compare($F1,$F2)==1) {print"they are different"; #opening/creating all three open (FH1,$F1)||die "cannot open $F1.\n"; open (FH2,$F2)||die "cannot open $F2.\n"; open (FH3,'>',$F3)||die "cannot create/open $F3.\n"; while () { last if eof(FH2); $content2=; #reads the complete file to content2. chomp($_, $content2); #haven't yet figured out how to pull out the difference data. } close(FH1); close(FH2); close(FH3); } elsif(compare($F1,$F2)==-1) {print"error";} else {print"something wrong";} print"Please check the file differ.txt";