# replace this line # $PRETEND || -e "$newdir" || mkdir("$newdir"); # with this unless ($PRETEND || -e $newdir){ mkdir($newdir) or die "ERROR creating $newdir : Perl says $!"; }