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.