in reply to regex, find words that occur more than once.
You don't tell us why which leaves plenty of room for guessing. If you don't need to use a regex you can get a count of word use like this:
use strict; use warnings; my $text = "and him him lad has him done and john has has"; my %words; ++$words{$_} for split /\s+/, $text; print "$_: $words{$_}\n" for sort keys %words;
Prints:
and: 2 done: 1 has: 3 him: 3 john: 1 lad: 1
If that's not helpful for your immediate problem you might like to give us some more context.
Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond
In Section
Seekers of Perl Wisdom