in reply to Multiple outputs in a CGI script

Go steal some code from Tom Christiansen.

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.