To create a directory, use the mkdir command:
mkdir($directory_name, $mode);
The $mode value is a numeric set of UNIX read, write, and execute permissions.
The $mode value is masked by your default umask value.
The mkdir command returns a true value on success and false on failure.
If it fails, mkdir sets $! with an error.
UNIX permission values used for the $mode value, shown as octal values.
The leading zero means these values are octal.
Value Meaning
0400 Owner of file has read permission.
0200 Owner has write permission.
0100 Owner has execute permission.
0040 All users in same group have read permission.
0020 Group users have write permission.
0010 Group users have execute permission.
0004 All users have read permission.
0002 All users have write permission.
0001 All users have execute permission.
For example, 0666 means all users can read and write.
Related examples in the same category