if (isValidValue($num)) { # Do stuff here. } return undef unless isValidValue($num2);