in reply to Print to the screen and a log at the same time?

After you open LOG but before you print anything, add this code:
if (!(my $pid = open(STDOUT, "|-"))) { die "fork failed: $!" unless defined $pid; while (<STDIN>) { print $_; print LOG $_; } exit; }
This will fork a child process that will capture everything sent to STDOUT. The print statements appear to the child as STDIN. What you do with it is up to your code.