#N:\...\Auswertung $input_directory = "C:\\Answ...TI\\"; $output_directory = "N:\\e...ertung\\"; $output_filename = "ergebnisse.txt"; @input_filenames = ( '2ds.VD', '2ds-csp.VD', '2ds-cspswh.VD', '2ds-swh.VD', '4ds.VD', '4ds-csp.VD', '6ds.VD', '6ds-csp.VD', ); # prepare output file open OUTFILE, ">", $output_directory.$output_filename or die "Cannot open FILE $output_filename in $output_directory.\n"; # foreach input file, open it, and process foreach $file (@input_filenames) { # Get the scenario ID, ie. the first part of the filename up to the . $scenario_id = $file; $scenario_id =~ s/\..+//; print "# Szenario_ID: $scenario_id\n"; open INFILE, "<", $input_directory.$file or die "Cannot open INFILE $file in $input_directory.\n";; $cnt = 0; $line = ; chomp $line; while ($line = ) { if ($line =~ m/^\*/) { $cnt++; next; } if ($line =~ m/^\s+/) { $cnt++; next; } print OUTFILE "\"$scenario_id\",".$line; } close INFILE; } # close output file close OUTFILE;