in reply to problem in checking if directory exists

denzil cactus:

One thought occurs to me: if you got $dir from the user and forgot to chomp it, you'll have a trailing EOL in it. The `mkdir -p $dir` won't care about it, but -d $dir might. (I've not tested it, so I'm not certain.) If that's the case, then -d would report that the directory "foo\n" doesn't exist even when "foo" does, causing mkdir to run each time you execute your code.

...roboticus