in reply to Automatically killing a child

See perlopentut for details, but note that piped-opens return the pid of the forked child.

#!/usr/bin/perl my $kid = open (HTML, "-|") or exec("tail","-f","testlog.txt"); print while <HTML>; kill 2, $kid;

You can use that to kill or wait or waitpid, but as tail -f file will never terminate* unless the file goes away, you will probably need to kill it.

That said, if the file never goes away, tail will never terminate, so your print while <HTML> will never get eof, so you will never exit that loop in order to try and use kill.

*those versions of tail I've used.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.