The regular expression isn't an array you can foreach through. It returns something like a true false value while the iterator is true instead.
Not true, the OP used the 'g' flag which makes the regexp return a list of matched groupings when in list context (and foreach expects a list).
So to combine foreach with a regexp is just fine, in fact Cazbo you are close to the solution!
Hint: to debug execute a
print "$wordcount, $_\n";
within your foreach loop immediately after you do the autoincrement and see what it prints. Your regexp needs some finetuning and what about the counter itself?