Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: Re: Create a list of directories without . and ..

by dsheroh (Monsignor)
on Jun 04, 2002 at 19:37 UTC ( [id://171615]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Create a list of directories without . and ..
in thread Create a list of directories without . and ..

You are correct about . and .. - getting a regex to match them reliably is far trickier than it looks. The obvious m/^\.\.?$/, for instance, will give a false positive on "..\nsubdir". Much safer and simpler to just test on ($_ ne '.') && ($_ ne '..'). (BTW, != is numeric. Use ne for strings.)

Replies are listed 'Best First'.
Re: Re: Re: Re: Create a list of directories without . and ..
by Juerd (Abbot) on Jun 04, 2002 at 22:41 UTC

    The obvious m/^\.\.?$/, for instance, will give a false positive on "..\nsubdir"

    No, only on "..\n" and ".\n".

    - Yes, I reinvent wheels.
    - Spam: Visit eurotraQ.
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-26 05:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found