PerlMonks taught me about Regexp::Assemble, an excellent module for building regex patterns from lists of strings.
#!/usr/bin/env perl
use Modern::Perl;
use Regexp::Assemble;
my @to_remove = qw( is an to for from );
my @strings = ( 'is that true',
'this is from presentation',
'to create',
);
my $re = Regexp::Assemble->new->add(@to_remove);
# say $re; # uncomment to see the regex it makes
map { s/$re//g } @strings; # remove strings anywhere
# map { s/\b$re\b//g } @strings; # or just remove whole words
say for @strings;
Aaron B.
Available for small or large Perl jobs; see my home node.