in reply to Finding duplicate words in a paragraph

It looks like you mean you want to find a word that is followed by itself in a paragraph, right? If so, I think the only real error in your code is $/ = " ", which should be $/ = "". That is no, the empty string, not a string with a space in it.

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart