use strict; use warnings; use File::Compare; use Getopt::Long; $| = 1; sub help { print STDERR < \$help, 'log|logfile=s' => \$logdatei, 'f1|file1=s' => \$file1, 'f2|file2=s' => \$file2 ); help() if $help; print "\x07### ERROR: Dateiname erste Datei fehlt" and help() if not length $file1; print "\x07### ERROR: Dateiname zweite Datei fehlt" and help() if not length $file2; print "\x07### ERROR: Dateiname Log-Datei fehlt" and help() if not length $logdatei; my %exclude; my $compare = compare($file1,$file2); open my $fh1, '<', $file1 or die $!; while (<$fh1>) { chomp; $exclude{$_}++; } close $fh1; open my $logfh, '>', $logdatei or die $!; open my $fh2, '<', $file2 or die $!; while (<$fh2>) { chomp; if($compare == 1){ print $logfh "False! the files are not equal \n"; print $logfh "$_\n" unless $exclude{$_}; } elsif($compare == 0){ print $logfh "True! the Files are equal \n"; } } close $fh2; close $logfh;