use POSIX qw(strftime); my $ts = strftime("%Y%m%d %H:%M:%S", localtime);