if ($shell ne "" and $shell !~ /false/ and $shell !~ /null/) { # it's ok }