# given @words and @exclude my %seen; @seen{@exclude} = (1) x @exclude; @words = grep { (! /\W/) and (length() >= 4) and ($seen{$_}++ == 0) } @words;