It's not clear that 'abbc' is a false positive, and it is not clear that skipping 'is' (as your code does) is appropriate. However the following fixes the supposed false positive and retains the possibly desired 'is':
use strict;
use warnings;
my $str="this is abc and bcf and xyz and ijklmn but not abbc";
my @words = split ' ', $str;
my @incWords = grep {
my %uniq = map {$_ => 0} split ''; $_ eq join '', sort keys %uni
+q
} @words;
print "@incWords";
Prints:
is abc bcf xyz ijklmn not
DWIM is Perl's answer to Gödel
|