http://www.perlmonks.org?node_id=1013259


in reply to Close a file and reopen a new one at midnight

Being clueless, I was wondering why there's no file tie module that performs this task ...

Here you go ... Tie::Handle::FileWriteRotate

use Tie::Handle::FileWriteRotate; tie *FH, 'Tie::Handle::FileWriteRotate', dir=>'/some/dir', prefix=>'myapp', print FH "Logging a line\n"; print FH "Logging another line\n";