in reply to dir match, dir may or may not appear
$path =~ m|^usr/(?:/[^/]+)?/bin/|
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.
www.com | www.net | www.org
No recent polls found