my $date_str1 = '22.6.1980'; my $date_str2 = '2.12.1901'; $worksheet->write(1, 6, sprintf('%02d.%02d.%4d', split(/\./, $date_str1)), $format7); $worksheet->write(1, 7, sprintf('%02d.%02d.%2d', split(/\./, $date_str2)), $format8);