Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Alternate command for tmpnam

by kishore05 (Initiate)
on Sep 01, 2021 at 06:53 UTC ( [id://11136326]=perlquestion: print w/replies, xml ) Need Help??

kishore05 has asked for the wisdom of the Perl Monks concerning the following question:

Hi please help me with providing alternative command/method for tmpnam to create a temporary file name in perl script
#!/usr/bin/perl use Fcntl; use POSIX qw(tmpnam); use POSIX qw(ceil floor); use Cwd; use IPC::Open2; use POSIX qw(strftime); use Socket qw(:DEFAULT :crlf); $tmpname = tmpnam(); print $tmpname; $tmpname = $tempdir."V".(split /V/, $tmpname)[-1].".icd"; print $tmpna +me;

2021-09-01 Discipulus added code tags

Replies are listed 'Best First'.
Re: Alternate command for tmpnam
by Corion (Patriarch) on Sep 01, 2021 at 06:57 UTC
Re: Alternate command for tmpnam
by Discipulus (Canon) on Sep 01, 2021 at 07:20 UTC
    Hello kishore05 and welcome to the monastery and to the wonderful world of perl!

    Please follow Corion's advice and also, please put <code> ..</code> tags around your snippet.

    You can also be interested into sysopen function in junction with O_CREAT flag: you can cycle various file names until it returns not an error.

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re: Alternate command for tmpnam
by Anonymous Monk on Sep 01, 2021 at 11:11 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11136326]
Approved by johngg
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-03-28 12:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found