http://qs321.pair.com?node_id=11121776


in reply to regex, find words that occur more than once.

I finished my script like so:

use strict; use warnings; my %words; my $text = "and him him lad has him done and john has has"; while($text=~/\b(\w+)\b(?=.*\b\1\b)/g){ $words{$1}++; } foreach my $key(keys %words){ my $count = $words{$key} + 1; print "$key: $count\n"; }

Again thank you for the advice.