my $file = "textfile.020701_00:08"; my $time = substr($file, 9,12); $time =~ s/(\d{6})_(\d{2}):(\d{2})/"$1$2$3.monday"/; print "TIME: $time";