Answers for "Create a directory in perl if it doesn't exist"

0

Create a directory in perl if it doesn't exist

use strict;
use warnings;

sub main {
    my $directory = "temp";
    
    unless(-e $directory or mkdir $directory) {
        die "Unable to create $directory\n";
    }
}

main();
Posted by: Guest on October-10-2021

Code answers related to "Create a directory in perl if it doesn't exist"

Browse Popular Code Answers by Language