my $write_file = "c:/trxlogfile.txt"; open(OUT, ">$write_file" ) || die "Kann die Datei nicht erzeugen: $!"; foreach (@ARGV) { @array_result=work_with_file($_, OUT); } close(OUT);