in reply to create randomize file name
The POSIX function tmpnam() will give you a random filename that you can use to create a temporary file (race conditions notwithstanding):
#!/usr/bin/perl -w use strict; use POSIX 'tmpnam'; print tmpnam(), "\n";
Alternatively, you could use File::Temp, which is core in more recent versions of perl. This will provide you with a named or unnamed filehandle without the race condition worries. It supports several flavours of temp file creation including one that allows a template to be included in the filename:
use File::Temp ':mktemp'; my ($fh, $filename) = mkstemp( "filename.XXXX" ); print $filename, "\n";
--
John.
|
|---|