in reply to Print to the screen and a log at the same time?
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; }
|
|---|