Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: reading output from another script

by Chady (Priest)
on Jul 23, 2003 at 14:31 UTC ( [id://277167]=note: print w/replies, xml ) Need Help??


in reply to reading output from another script

Why the array? can't you just pipe it and read one line at a time?

#script.pl $|++; my $i = 0; while (1) { $i++; print $i % 50000 == 0 ? "Event" : "stuff\n"; } #monitor.pl while (<STDIN>) { if (/Event/) { notify(); } } sub notify { print "Got notification.\n"; } $ ./script.pl | ./monitor.pl
Update: added sub notify { } in code.
He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

Chady | http://chady.net/

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-25 15:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found