my $write_file = "c:/trxlogfile.txt"; my $fh = new IO::File; if ($fh->open("> $write_file")) { #open(OUT, ">$write_file" ) || die "Kann die Datei nicht erzeugen: $!"; my @array_result; my $string_result; my %hash; foreach (@ARGV) { $string_result=work_with_file($_, $fh, \%hash); push(@array_result, $string_result); } foreach my $key (sort keys %hash) { print $fh "$key:\n$hash{$key}\n\n"; } #my $laenge = @ARGV; for my $i (0..$#ARGV){ print $fh "$ARGV[i]\n\n $array_result[i]\n"; } } $fh->close;