This will fork a child process that will capture everything sent to STDOUT. The print statements appear to the child as STDIN. What you do with it is up to your code.if (!(my $pid = open(STDOUT, "|-"))) { die "fork failed: $!" unless defined $pid; while (<STDIN>) { print $_; print LOG $_; } exit; }
In reply to Re: Print to the screen and a log at the same time?
by ruzam
in thread Print to the screen and a log at the same time?
by jcpunk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |