my %seen; my @long = grep length>4 && !$seen{$_}++, @array;