if ($stringToTest =~ m/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/ && check_date($1, $2, $3) && check_time($4, $5, $6) ) { print "It's OK\n"; }