in reply to Re: Output redirection using “require” in perl
in thread Output redirection using “require” in perl
Adding *STDOUT = $o; to the above, will make it succeed in redirecting also the print statements which explicitly state the filehandle to be STDOUT, e.g. print STDOUT "...":
perl -I. -e 'open my $o, ">out"; *STDOUT = $o; select $o; require "b.pl";'
|
|---|