Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: "unique" filename?

by quidity (Pilgrim)
on Dec 03, 2000 at 22:22 UTC ( #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.

Comment on Re: "unique" filename?
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2015-11-26 11:12 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (697 votes), past polls