in reply to Problems with Filehandles and TeeOutput

You might also want to consider testing the success of your open before going on. That is, replace
open (LOG, ">>test.out");
with
open (LOG, ">>test.out") or die "Failed to open test.out: $!";