my $maxdate = "2006-06-06"; my $m_year = $maxdate; my $m_month = $maxdate; $m_year =~ s/(^.*)\-.*\-.*/$1/; $m_month =~ s/^.*\-(.*)\-.*/$1/;