in reply to deleting a file in perl
This is a way, but not the only way, (and perhaps not the best way)
Alternatively:
If you are in a Linux OS consider to use find2perl to search for old files, maybe copy the newest to a different place, and delete files if its filename match AND its timestamp is older than X days or months. See mtime, atime, etc.
or
manage your log files with a specific module. Look here.
|
|---|