- or download this
printf STDERR "before: fileno(STDOUT)=%d\n", fileno(STDOUT);
...
pipe( $smash_stdout, STDOUT );
printf STDERR "after: fileno(STDOUT)=%d\n", fileno(STDOUT);
- or download this
before: fileno(STDOUT)=1
after: fileno(STDOUT)=6
- or download this
printf STDERR "before: fileno(STDOUT)=%d\n", fileno(STDOUT);
...
open STDOUT, ">&WH" or die "open: $!";
printf STDERR "after: fileno(STDOUT)=%d\n", fileno(STDOUT);
- or download this
before: fileno(STDOUT)=1
after: fileno(STDOUT)=1
- or download this
open $old_stdout, ">&STDOUT" or die "open: $!";
local(*RH, *WH);
...
my $out = <RH>;
print STDERR "got from pipe: $out"; # $out is "foobar\n"