in reply to reading all files in a dir
If you look at your grep statement, you're only selecting files that start with a "dot". Ok; this is well and good. Indeed, it works just as I would expect (I run it and get this:
. ..
I'm thinking this is the opposite of what you want, which is probably the files which don't start with a period, in which case your grep statement would look like this:
which will take out files which start with a period instead of the files which don't. As an (possibly preferable) alternative, you could use this:my @dots = grep { ! /^\./} readdir(DIR);
my @dots = glob("*"); # adjust argument to glob as needed
Most of the time, I tend to prefer glob, mostly because I'm lazy (it saves a lot of typing). The exception is when I've got to deal with Windows (which is most of the time), where I find that glob seems to get confused with filenames containing blanks (yeah, I could escape them).
emc
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.
|
|---|