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.)