# thezip's method: $fn = sprintf "%s.%04d-%02d-%02d-%02d%02d%02d.ext", $base_name, (localtime)[5,4,3,2,1,0]; #### # my method (from CB): $fn = ''; { open my $fh, '>', \$fn; print $fh $base_name, '.'; print $fh strftime("%F-%T"); }