in reply to Regex EOF

My suggestion would be to use the word boundary character, like m/\b([A-Za-z\d]+)\b/. This should match all words because word boundary includes the start of lines and end of lines in addition to spaces. Though simpler yet might be just m/\b(\w+)\b/ depending on what chars you need to match.