http://www.perlmonks.org?node_id=492850


in reply to Temp file strategy

Here's what I do: name your files after the value of time. This is (almost?) certain to give you unique names, and it's easy to search through the temp directory and sort by age - sweeping the old ones. Watch out for the corner case where two requests are made within a second. May need to lock the files?