open my $DATEI, ">>", "path1" or die "failed to open path1 $!"; # if you open it only once, then ">" might be better than ">>" but I don't know the wider context