in reply to Automatically creating incremental file names
Don't use the PID for things like this. It's not as random as you think it is (OpenBSD is the only exception that I know of).
You could try loading all your data into a scalar, and then running an SHA1 hash on that data. The base64 value of the hash will be your filename. Just in case the impossible happens, check for the existance of that file and append some data to it each time through the loop, such as:
$filename .= '0' while(-e $filename);
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
Note: All code is untested, unless otherwise stated
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Automatically creating incremental file names
by graff (Chancellor) on May 28, 2003 at 02:30 UTC | |
by hardburn (Abbot) on May 28, 2003 at 13:39 UTC |