use POSIX qw(strftime); $now_string = strftime "error%Y-%m-%d.txt", localtime; print "$now_string\n";