```{index} single: mkstemps; File::Temp function ``` ```{index} single: File::Temp::mkstemps; Perl function ``` # mkstemps Create a file from a template with a literal suffix preserved at the end of the name. ## Synopsis ```perl my ($fh, $path) = mkstemps('/tmp/dataXXXXXX', '.log'); ## $path looks like /tmp/dataAb3c9F.log ``` ## What you get back In list context `($fh, $path)`; in scalar context just the filehandle. The suffix is appended to the template before filling, and the `X`s before it are the ones replaced. ## Examples ```perl use File::Temp qw/ mkstemps /; my ($fh, $path) = mkstemps('/var/tmp/rpt-XXXXXX', '.json'); ``` ## Edge cases - The suffix is a literal string, not a length count. - Template with fewer than four trailing `X`s before the suffix: croaks. - Wrong arg count: croaks with a usage message. ## Differences from upstream Fully compatible with upstream `File::Temp` 0.2312. ## See also - `mkstemp` — same idea, no suffix handling. - `tempfile` — use `SUFFIX => ...` for a named-option form.