in reply to Automatically Deleting Files Periodically

using Cache::FileCache instead of directly creating/reading the files might work for you too, and you can take advantage of it's innate expiration functionality.
  • Comment on Re: Automatically Deleting Files Periodically