in reply to IO::Tee not behaving correctly

Well, if that test program works correct, how shall we find the error?

Post the failing program, if it's not too large, or put it somewhere where we can take a look.