Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Preprocessing print statements

by salva (Canon)
on Nov 12, 2020 at 09:27 UTC ( [id://11123603]=note: print w/replies, xml ) Need Help??


in reply to Preprocessing print statements

You can fork a new process for doing the filtering in parallel:
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!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11123603]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2024-04-19 23:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found