[EMAIL PROTECTED] wrote:
> If you dont understand my question then I assume you do not know unix
> or tail -f ?

You're right, those are both new to me.

>  I want to after a sleep of 5-8 seconds, send a kill
> signal to the previous command then increment the counter.  thank
> you!

Sorry, I think I understand the question now. If you want to run something
like tail -f that never exits and then kill it after a while, you'll need
the PID number. So you can't run it via system() or backticks, since those
don't return until the subprocess exits.

Something along these lines should work inside your loop:

     my $pid = open(PIPE, "tail -f /etc/passwd |") or die $!;
     local $SIG{ALRM} = sub { kill 'TERM', $pid };
     alarm 5;
     print while(<PIPE>);
     alarm 0;
     close PIPE;

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to