my $url = 'http://www.perlmonks.org/'; my @regexes = ('/private(?:/|$)', 'python'); if (grep { $url =~ $_ } @regexes) { # handle bad URL } else { # handle good URL }