in reply to Re: Count number of words on a web page?
in thread Count number of words on a web page?

Use word boundaries (\b).
$_ ='The,quick,brown;foxy. Does a lot,of:jumping!'; my @words = split(/\W*\s+\W*/, $_); # split into words print 'Number of words: '.@words."\n";
gives 4 words. However
my @words = split(/\b\W*/, $_); # split into words
gives 9 words.