in reply to Preprocessing print statements
use POSIX; ... my $pid = open(STDOUT, "|-") // die "unable to fork new process"; unless ($pid) { while (<>) { print if /the-regular-expression-goes-here/ } POSIX::_exit(0); } # after this point, STDOUT is filtered
Update: That works in Unix/Linux systems. I am not sure about Windows, but probably not!
|
|---|