unless ( $month && $year1 ) { # your error code here... }