Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: dir match, dir may or may not appear

by hellosarathy (Novice)
on Jan 12, 2016 at 10:26 UTC ( [id://1152546]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1152546]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-03-28 17:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found