in reply to Output to STDOUT and print last line to console

hello wayto perl

I think Log4perl can do this in the right way.

The ability to multiplex the output (this seems the correct term) of Log4Perl can help you a lot, but if you want to try to code it by hand you can explore my similar 'proof of concept' approach in Multiplexing log output: Log4perl of the poors.

HtH
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.