Help for this page

Select Code to Download


  1. or download this
    my $out = `cmd-to-run 2>&1`;
    # Should really check command return code via $? special variable here
    # Then print $out via your $tee here
    # Note: 2>&1 (to fold stderr into stdout) works fine on Windows XP
    
  2. or download this
    open(my $fh, 'cmd-to-run 2>&1 |') or die "open error: $!";
    while (<$fh>) {
        # print $_ via your $tee here
    }
    close($fh) or die "close error: $!";