use strict; use warnings; use 5.010; use Date::Manip::Date; my $string = 'Nov-07'; $string .= ' 01'; #add day field to string my $format = '%b-%y %d'; my $date = new Date::Manip::Date; my $error = $date->parse_format($format, $string); if ($error == 0) { #everything worked correctly say $date->printf('%Y/%m'); } else { say "something went wrong"; if ($error == 1) { say "format didn't match your string"; } else { say "format is invalid--won't create a valid date: $error"; } } --output:-- 2007/11