in reply to hash comparison
You would be better off splitting on /\W+/, rather than just /\W/
Consider:
say scalar split /\W/, "the cat is the on the mat"; # 7 say scalar split /\W/, "the cat is the on the mat"; # 13 say scalar split /\W+/, "the cat is the on the mat"; # 7 say scalar split /\W+/, "the cat is the on the mat"; # 7
In Section
Seekers of Perl Wisdom