if (/$word/i) { print unless (++$matches{$word} > 1) }