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


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

Thanks... what you gave worked:
$path =~ m|^usr/(?:/[^/]+)?/bin/|

Replies are listed 'Best First'.
Re^2: dir match, dir may or may not appear
by GrandFather (Saint) on Jan 13, 2016 at 05:34 UTC

    As a general thing don't use | as a regex delimiter because it is the alternation (or) character. It allows you to match cat or dog m~cat|dog~ for example.

    Premature optimization is the root of all job security