use Date::Manip; my $maxdate = "2006-05-11"; my($m_year, $m_month) = UnixDate($maxdate, "%Y", "%m");