in reply to Re: Creating new folders
in thread Creating new folders

In general I try very hard to avoid the race condition that come from assuming the result of a filetest operator remains valid. In this case it is possible that something creates the directory between the moment of the -d and the mkdir and that's a case I'd prefer to work instead of fail. In many real cases this is impossible or not an issue of course, but I still prefer my code to be able to handle such cases. So normally I'd write:
if (!mkdir($dir)) { my $err = $!; die "Could not create $dir: $err" unless -d $dir; }