in reply to Re: Handling returns from mkdir.
in thread Handling returns from mkdir.

Good point. But remember that TOCTOU might be a problem. mkdir $directory, check $!, and ignore EEXIST ("File exists"). After that, $directory may still be something non-directory, but you will know that when chdir $directory or open(...,"$directory/filename") fails with ENOTDIR ("Not a directory").

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)