http://qs321.pair.com?node_id=1152538


in reply to dir match, dir may or may not appear

What syntax error and where? Perl is usually quite informative with its error messages.

Most likely, it's a syntax error in your regular expression. See perlre, especially about quantifiers.

Personally, I would reformulate the problem as "any directory that starts with /usr/ and ends with /bin, and do the checking in two regular expressions instead.