if (!(my $pid = open(STDOUT, "|-"))) { die "fork failed: $!" unless defined $pid; while () { print $_; print LOG $_; } exit; }