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


in reply to Re^3: How do you find duplicates in a string?
in thread How do you find duplicates in a string?

you'll need a hash to check for the dupes.
$hash{$_}++ foreach(split /\t/,$string); foreach (keys (%hash)) {print $_."\n" if ($hash{$_} > 1 && /^\D+$/)}


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"one who asks a question is a fool for five minutes; one who does not ask a question remains a fool forever."

mk at perl dot org dot br