my $filename2 = 'beispiel.csv'; if (open(my $fh2, '+<:encoding(UTF-8)', $filename2)) { while (my $row2 = <$fh2>) { my $laenge=length($row2); if ($laenge == $globla) { for my $stellen (@stellen) { substr $row, $stellen,1,';'; } print $fh2 $row2; } } } else { warn "Could not open file '$filename2' $!"; }