#!/usr/bin/perl use strict; use warnings; my @files = qw(ZIEL1.txt ZIEL2.txt ZIEL3.txt ZIEL4.txt); my $output = 'ZIELgesamt.txt'; open(my $write_fh, '>', $output) or die $!; for my $file(@files){ open(my $fh,'<',$file) or die $!; while(my $line = <$fh>){ $line =~ tr/\xa0//d; print $write_fh $line; } close $fh; } close $write_fh or die $!;