my $left_text = [ qw{ when rome romans} ]; my $right_text = 'When in Rome, do as the Romans.'; # generate $regex and $flags somehow my $found = $right_text =~ m/$regex/$flags;