I tried this with File::Path.
It'll return "mkdir winlog" on success, undef if file already exists, or a message if something else went wrong.
#!/usr/bin/perl
use strict;
use warnings;
use File::Path qw(make_path);
my $dir = 'winlog';
make_path(
$dir,
{
verbose => 1,
mode => 0711,
}
);
open STDOUT, '<', $dir
or die "Couldn't open $dir: $!\n";