in reply to Multiple outputs in a CGI script
Use that Tie::Tee to create a handle called "TEE", and then switch between TEE and STDOUT using select. See "perldoc -f select" for details.