in reply to Perl/Cgi : how to delete file after leaving original myscript.cgi?
You might want to look at using some descendant of Cache::Cache and let it handle expiring old items after n minutes or hours.