my $dir 	= "/home/Framework/DemoParser/log/";
my @array 	= ();
my $vs 		= "versicherung.txt";
unlink $vs;

opendir(DH,$dir );
my @files = readdir(DH);
closedir(DH);

foreach my $file (@files)
{
    
	# skip . and ..
    next if($file =~ /^\.$/);
    next if($file =~ /^\.\.$/);
	if ($file =~ /\.txt$/){
		print "Working on : $file\n";
		open(R,"<$dir/$file");
			while(<R>){
				push(@array,$_);
			}
		close R;
	}
    # $file is the file used on this iteration of the loop
}

open(W,"+>$vs");
binmode(W);
print W @array;
close W;

my %hash   = map { $_ => 1 } @array;
my @unique = keys(%hash);

foreach my $w (@unique){
	# next if (length($w)<90);
	# next if ($w !~ m/(\.$|\!$|\?$){1}/);
	#print W $w;
}