in reply to Convert Date formats

Here is a way to do it with Date::Manip, although as far as I can tell your string does not contain a valid 'date'--because it does not specify a day. So you have to alter your string first:

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

See here for details:

http://search.cpan.org/~sbeck/Date-Manip/lib/Date/Manip/Date.pod