use Regexp::Common qw(time); my $date = '2008-12-31'; print "yes" if $date =~ $RE{time}{tf}{-pat=>'yyyy/mm/dd'};