I have a script that logs its progress to a file. This is important to catch errors, however, when I leave the script running for long periods the logs can get very big (I just restarted the script and deleted a 3GB log). Is there any way to tell perl that when a file you are writing to gets over x lines long, to delete a line for every line you insert?