```{index} single: mkdtemp; File::Temp function ``` ```{index} single: File::Temp::mkdtemp; Perl function ``` # mkdtemp Create a directory from a template and return its path. ## Synopsis ```perl my $dir = mkdtemp('/tmp/buildXXXXXX'); ``` ## What you get back The pathname of the directory created with mode `0700`. The directory is not registered for cleanup — it remains until the caller removes it or arranges for cleanup themselves. ## Examples ```perl use File::Temp qw/ mkdtemp /; my $dir = mkdtemp('/var/tmp/stageXXXXXX'); ## caller owns $dir; remove with rmtree / File::Path ``` ## Edge cases - Template with fewer than four trailing `X`s: croaks. - Wrong arg count: croaks with a usage message. ## Differences from upstream Fully compatible with upstream `File::Temp` 0.2312. ## See also - `tempdir` — higher-level variant accepting `CLEANUP => 1`. - `File::Temp->newdir` — OO form that removes the tree automatically. - `mkstemp` — file counterpart.