Created
November 21, 2018 19:43
-
-
Save jflopezfernandez/c19d7ec5ae6af493e971221db74cf426 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/perl | |
# Uses file existence operator to test whether specified directory already exists. | |
# Directory name input mechanism is not assumed; trivial example provided. | |
# | |
# Author: Jose Fernando Lopez Fernandez | |
# Date: 21-November-2018 | |
# | |
# Note: "say" function requires "use v5.10" or higher | |
my $newDirectoryName = "New-Directory"; | |
if (-e $newDirectoryName) { | |
say "[Error]: Directory Already Exists."; | |
} else { | |
say "Creating new directory: $newDirectoryName"; | |
my $status = mkdir($newDirectoryName); | |
say "[Status]: $status"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment