$month = $month + 1; #localtime returns mth as 0 to 11 $outfile = sprintf "%s/%4d-%2.2d-%2.2d-", $base_dir, $year + 1900, $month, $day;