&SchreibeExcel; sub SchreibeExcel {      open(XLS, ">>datei.csv") or die $!;  #speichert foreach (@erste_Zeile) { chomp ($erste_Zeile[$index]); chomp ($zweite_Zeile[$index]); chomp ($dritte_Zeile[$index]); chomp ($vierte_Zeile[$index]); print XLS "$erste_Zeile[$index], "; print XLS "$zweite_Zeile[$index], "; print XLS "$dritte_Zeile[$index], "; print XLS "$vierte_Zeile[$index],"; print XLS "$funfte_Zeile[$index]"; $index++ }#end foreach }#end SchreibeExcel der neue code wegen dem modul sieht jetzt so aus: sub SchreibeExcel { my $workbook = new Spreadsheet::WriteExcel("datei.cvs"); my $sheet1 = $workbook -> add_worksheet( "übersicht" ); my $k=0; my $s=0; my $s1=1; my $s2=2; my $s3=3; my $s4=4; foreach (@erste_Zeile) { chomp ($erste_Zeile[$index]); chomp ($zweite_Zeile[$index]); chomp ($dritte_Zeile[$index]); chomp ($vierte_Zeile[$index]); chomp ($funfte_Zeile[$index]); $sheet1 -> write( $k, $s, "$erste_Zeile[$index]" ); $sheet1 -> write( $k, $s1, "$zweite_Zeile[$index]" ); $sheet1 -> write( $k, $s2, "$dritte_Zeile[$index]" ); $sheet1 -> write( $k, $s3, "$vierte_Zeile[$index]" ); $sheet1 -> write( $k, $s4, "$funfte_Zeile[$index]" ); $index++; $k++; }#end foreach $workbook -> close(); }#end SchreibeExcel