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

Re: "unique" filename?

by quidity (Pilgrim)
on Dec 03, 2000 at 22:22 UTC ( [id://44688]=note: print w/replies, xml ) Need Help??


in reply to "unique" filename?

The module File::MkTemp seems to be what you want:

use File::MkTemp; $dir = '.'; # directory to create file in $string = mktemp('tempXXXXXX',$dir); open(F,$string);

Will return a unique file name, you can also have it return a unique file handle so that there is no chance of opening an identical file in two instances of your script:

use File::MkTemp; $dir = '.'; # directory to create file in $fh = mkstemp('tempXXXXXX',$dir); print $fh "stuff"; $fh->close;

You can add more 'X's, but you need at least six.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-19 18:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found