#!/usr/bin/perl use strict; use warnings; my @files = qw(bla1.txt bla2.txt bla3.txt bla4.txt); my $output = 'blagesamt.txt'; for my $file(@files){ open(my $fh,'<',$file) or die $!; open(my $write_fh,'>>',$output) or die $!; while(my $line = <$fh>){ print $write_fh $line; } close $write_fh or die $!; close $fh; }