in reply to creating directories

Using the File modules helps in this. Otherwise you have to redo your own work. File::Path would be specific for your current needs. And since File is installed along with the base installation, you should be set.
Some of your problems have to do with constructing the directory path deep enough. The other has to do with "\" and "/" system differences.

Update:I'm also looking at your code and I agree with Fastolfe, those two should be functionally equivalent, but since you use a "/" it should say that you have an invalid argument. All bets are off if the mkdir is actually the cygnus version. One problem with system calls, they might different programs on different machines based on the search path they inherit. Go with the File modules, you'll be happier in most cases.