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";'In reply to Re^2: Output redirection using “require” in perl
by bliako
in thread Output redirection using “require” in perl
by Sandeep Kumar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |