http://qs321.pair.com?node_id=1003855

anshumangoyal has asked for the wisdom of the Perl Monks concerning the following question:

There is a program which keeps on writing in a log file at a very fast rate. The rate is so fast that the file reached 250 MB in just 30 seconds. In perl script I want to write a program which rotates this file. i.e. when ever the size of this file reaches 100 MB, I want to flush all contents of this file and write in log_001.log so that all size remains 100 MB. Problem is when I rename the file, the file stops writing (may be due to file pointer being destroyed). What is the best possible thing that can be done here. I want the program to be efficient so that not too much of memory is being used as well.