#!/usr/bin/perl use warnings; $lies= "C:\\Batch\\Perl\\Werte.txt"; $schreib= "C:\\Batch\\Perl\\neu.txt"; open ($DATEI, "< $lies") || die $!; open ($REIN, "> $schreib") || die $!; while (my $string = ) { my ($D,$M,$Y)= $string =~ /^(\d\d?)\.(\d\d?)\.(\d{2,4})/; if (not defined $Y) { ($Y,$M,$D)= $string =~ /^(\d{4})(\d{2})(\d{2})/; } $anordnen = ($D.".".$M.".".$Y); print "$anordnen\n"; push @array, $anordnen; } print $REIN @array; close $DATEI; close $REIN;