.... my $datum0 = date_extra($file); textsformat("$entry/$file", $entry , $datum0); system "cat /home/dub/S/programming/perl/dp/textsformat.output >> $entry.tab"; }; }; closedir(DIR); }; }; sub date_extra { my $file0 = shift; my $date = substr($file0, 9,6); $date =~ s/(\d{2})(\d{2})(\{2})/$3\.$2\.20$1/; # why this command does not work return $date; }; ... ...