--- name: mkdir status: documented runtime: pp source: src/runtime/pp/directory.rs --- ```{index} single: mkdir; Perl built-in (pp runtime) ``` # mkdir ## Synopsis ```perl mkdir("newdir", 0755) or die "Cannot mkdir: $!"; mkdir("newdir"); # default mode 0777 (modified by umask) mkdir $_; # uses $_ if no argument ``` ## Description Creates a new directory with the specified permissions. Creates a directory with the given name. The optional second argument specifies the permissions mode (default `0777`), which is modified by the process umask before being applied. If no arguments are given, uses `$_` as the directory name. Returns 1 on success, 0 on failure. On failure, sets `$!` to the OS error code (e.g. `EEXIST`, `EACCES`). ## See also rmdir, chmod, umask