Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi, i have a piece of text and want to find all words that occur more than once by using a regex. Here is what i have so far.

use strict; use warnings; my $text = "and him him lad has him done and john has has"; while($text=~/(\w\w\w).*?\g1/g){ print "$1\n"; }

Something is wrong because he can't find the word 'him'. I hope you can help me find the right regex. Ty