Help for this page

Select Code to Download


  1. 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
    }
    
  2. or download this
    # Tee STDOUT to a log file
    use vars qw(*LOG);
    ...
    print "Hello, world #$_!\n" for (1..20);
    
    # XXX But, should have just used IO::Tee in first place :)