I think defined() is a good idea if there's a possibility of $foo being undefined, so as to avoid a warning about an undef being used in a string comparison/regex. Assuming an undefined value counts as a blank, I would write it like this:
if (!defined($foo) or $foo =~ m/^\??$/) {
# Foo is valid
}
Thus: "If foo is undefined, or matches an empty string or a single question mark."
But wasn't there something about \n's counting as "^" and/or "$"? Hmmm...
The Secret to Fortune Cookies in One Line
print join("... in bed", `fortune fortunes` =~ m/^(.*)(\.|\?|\!)$/), "\n";