The easiest option is to join the blacklist entry into one regular expression, and then grep list of keywords for those that do not match this regular expression:
#!/usr/bin/env perl use strict; use warnings; use 5.010; my @keywords = ('some good keyword', 'some other good keyword', 'some bad keyword'); my @blacklist = ('bad'); my $re = join '|', @blacklist; my @good = grep { $_ !~ /$re/ } @keywords; say join "\n", @good;
Output:
some good keyword some other good keyword
source share