#! perl -slw use strict; my $left_text = [ qw{ when rome romans} ]; my $right_text = 'When in Rome, do as the Romans.'; my $regex = '(?:\b' . join( '\b|\b', map quotemeta, @$left_text ) . '\b)'; print $regex; my $found = () = $right_text =~ m/$regex/ig; print $found ? 'matched: ' : 'Not matched', $found; __END__ C:\test>junk42 (?:\bwhen\b|\brome\b|\bromans\b) matched: 3