If you're going to go the regex approach, I might test for the presence of a non-whitespace character instead of looking to see that the string is composed entirely of whitespace. Generally this will be faster:
if ($string !~ /\S/) {
# $string is empty or composed entirely of spaces
}