```{index} single: mktemp; File::Temp function ``` ```{index} single: File::Temp::mktemp; Perl function ``` # mktemp Fill in the trailing `X`s of a template and return the resulting filename — does not create the file. ## Synopsis ```perl my $name = mktemp('/tmp/dataXXXXXX'); ``` ## What you get back A candidate filename string with random characters substituted for the trailing `X`s. No file is created; the caller must open it themselves and accept the race between naming and opening. ## Examples ```perl use File::Temp qw/ mktemp /; my $name = mktemp('/var/tmp/snapXXXXXXXX'); ``` ## Edge cases - Template with fewer than four trailing `X`s: croaks. - Wrong arg count: croaks with a usage message. - Unsafe against racing attackers — prefer `tempfile`. ## Differences from upstream Fully compatible with upstream `File::Temp` 0.2312. ## See also - `tempfile` — race-safe replacement. - `mkstemp` — same idea, but also creates and opens the file. - `tempnam` — `dir + prefix` variant.