or download this
# Usage: $teed_fh = tee @output_handles;
# Returns a new filehandle that, when written, copies to all @output_h
+andles
...
while( sysread(STDIN, my $block, 8192) ) { print $_ $block for @_
+}
kill 9,$$ or exit; # XXX Should use POSIX::_exit instead
}