Sorry if this is a rehash (no Perl pun intended) of a subject already
covered, but I have read all of the archived messages and scoured the net
for a solution to my problem with no success.

What I want to do is read data from a growing file (tail -f) until a special
record arrives, at which point I would like to close the file and reopen
another one repeating the process.

I almost got it to work with 

$datafile="File1";
while () {
   open(DATAIN,"tail +0 -f $datafile |"); 
   while ( <DATAIN> ) {
       print $_;
       if (substr($_,0,4) eq "SPEC") {
           $datafile=substr($_,4);
           last;
       }
   }
   close(DATAIN);
}

Datafiles are all 9 characters and a <LF> per record and of the form:
Record 01
Record 02
SPECFile2

The only problem is that I have to hit <Control C> on the keyboard to kill
the old tail process.  

Is there a way to send a signal to the open tail process so I don't have to
hit <control c> ?

Is there a better strategy for doing this?

Any help would be appreciated.

Mark Borghardt

Reply via email to