my $fh = open(FH, "/pfad/zur/datei.txt"); my $out = open(OUT, ">/pfad/zur/neuen_datei.txt"); my @lines = ; my $i = 0; foreach(@lines) { print OUT "$i. $_\n"; $i++; }