use strict; use warnings; use File::Compare; my %exclude; my $file1 = 'default_sysdumpdev_150319.txt'; my $file2 = 'd100spuptl25e0_sysdumpdev.txt'; my $compare = compare('d100spuptl25e0_sysdumpdev.txt', 'default_sysdumpdev_150319.txt'); open my $file, '<', 'default_sysdumpdev_150319.txt' or die $!; while (<$file>) { chomp; $exclude{$_}++; } my $txtdatei = 'compare.txt'; open my $txtfh, '>', $txtdatei or die $!; open $file, '<', 'd100spuptl25e0_sysdumpdev.txt' or die $!; while (<$file>) { chomp; if($compare == 1){ #print $txtfh "False! the files are not equal \n"; print $txtfh "FALSE! $_\n" unless $exclude{$_}; } elsif($compare == 0){ print $txtfh "True! the Files are equal \n"; } } close $txtfh;