sub loeschen() { my $f_content = $_[0]; my $c_number = $_[1]; my $state = "ok"; my $pos = 0; my $record; while ( ($pos+12) < length($f_content)) { $record = substr($f_content,$pos+3,4); if ($record == "2500" || $record == "2800") { substr($f_content,$pos,128, ""); } # löschen funktioniert if ($record == "1500" || $record == "1800") { substr($f_content,$pos,128, 0, " " x 128); } # einfügen nicht $pos += 128; } return $f_content, $state; }