in reply to Regex to match multiple words in an email subject
For multiple matches, it depends on the logic. If you want to match on any one, you could simply do
if (grep { $t_subject =~ $_ } qr/foo/, qr/bar/, qr/baz/) {
or
if (grep { $t_subject =~ $_ } map quotemeta, 'foo', 'bar', 'baz') {
On Perl 5.10 and later, you could even do
if ($t_subject ~~ [qr/foo/, qr/bar/, qr/baz/]) {
|
|---|