# Use quotemeta if companies are not really # foo and bar and contain metacharacters. my $companies = join("|", map(quotemeta, qw(FOO BAR))); print "$1\n" if $content =~ /($companies)/;