in reply to Finding duplicate words in a paragraph

It's easier to split to do that. When you want to handle uniqueness or duplication, think of using a hash.

my %hash; while (<>) { for (split) { print "dup word '$_' occurs at line $.\n" if $hash{$_}++; } }

You can make that $hash{+lc}++ if you want to ignore case.

After Compline,
Zaxo