willyyam has asked for the wisdom of the Perl Monks concerning the following question:
I needed a temporary file, but I wanted it to have a random name so a) I'd be less likely to succeed the "exists" test and b) so I don't have to delete my temp file during debugging. After reading this node I came up with this:
for ($i = 1; $i <= 8; $i++) { $filename .= chr( int(rand 26) + 97 ); } open(TMPFILE, ">$filename.html");
The question is, is this a good method? Am I being wrong-headed in the first place? Any pointers would be appreciated. Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Generating Random Filenames
by gam3 (Curate) on Apr 11, 2005 at 17:03 UTC | |
|
Re: Generating Random Filenames
by Roy Johnson (Monsignor) on Apr 11, 2005 at 17:04 UTC | |
|
Re: Generating Random Filenames
by cog (Parson) on Apr 11, 2005 at 16:57 UTC | |
|
Re: Generating Random Filenames
by jbrugger (Parson) on Apr 12, 2005 at 04:54 UTC | |
|
Re: Generating Random Filenames
by sh1tn (Priest) on Apr 11, 2005 at 17:13 UTC | |
by Mugatu (Monk) on Apr 11, 2005 at 20:07 UTC |