in reply to Regular expression

Assuming the date is in fixed-length format, you could also use unpack():
my $maxdate = "2006-06-06"; my ($m_year, $m_month) = unpack 'A4 x A2', $maxdate;