in reply to trying to implement file tail with regular expression
The second example of use seems to fit your situation:
use File::Tail; my $ref=tie *DIAG,"File::Tail",(name=>$name); while (<DIAG>) { # your while (1) loop processing goes here }
You open LOGFILE each time thru the outermost while, but close it only if the if statement is true. I would try to make this consistent; perhaps you don't need to close it, now that you have File::Tail to read it.
I believe you will not need the sleep statement anymore. File::Tail keeps track of how often it finds data, and adjusts how often it reads accordingly.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: trying to implement file tail with regular expression
by mkhayat (Initiate) on Feb 14, 2016 at 08:12 UTC | |
by Athanasius (Archbishop) on Feb 15, 2016 at 06:54 UTC | |
by mkhayat (Initiate) on Feb 16, 2016 at 08:47 UTC | |
by poj (Abbot) on Feb 16, 2016 at 12:01 UTC | |
by mkhayat (Initiate) on Feb 17, 2016 at 05:29 UTC | |
|