$old_umask = umask 000; # was 022 for example which would turn 0777 into
0755
$log_directory = "junky";
# you need the leading 0 in "0777" below to make the number hex
unless (-d "$log_directory") {
mkdir ("$log_directory", 0777) or die ("Cannot create log_directory.
$log_directory.
# the rest of the story (tested)
use Fcntl; # gets the constants like O_WRONLY
$old_umask = umask 000; # was 022 for example which would turn 0777 into
$log_directory = "junky";
unless (-d "$log_directory") {
mkdir ("$log_directory", 0777) or die ("Cannot create log_directory.