my ($word1, $word2) = split(/\s+/); if defined($word2) { ... }