Is this because I am using split? Is there a better way to go about this.
Yes. You're splitting on whitespace, and there's no whitespace between
uncomfortable and its following comma. Instead of splitting on whitespace, you might want to extract sequences of word characters - instead of
my @words = split;
you'd write:
my @words = /\w{5,}/g;
with the added benefit of not having to test of word length anymore, you're extracting words consisting of at least 5 characters.
I am sure I will start missing words that have apostrophes too.
Indeed. Extracting word characters will miss words containing apostrophes. Or hyphens. Extracting words from a random text, where the words can contain punctuation is not a trivial thing to do.
A'mous-Monk