my $left_text = [ qw{ when rome romans} ]; my $right_text = 'When in Rome, do as the Romans.'; my $regex = join "|", @$left_text; my $found =()= $right_text =~ m/($regex)/ig; print "$found\n";