|Just another Perl shrine
Here's my delima; im working on a script that uses a handy piece of code from the cookbook that more or less does a tail (-f) on my logfile. From there I process each line of the log as it comes in, for various reporting. My question is, how do I efficently remove lines from this logfile; for example if they match one of my regex's?
I have tried using the Tie::File module, but after some initial testing it does not seem to be the most effective means of accomplishing my goal. The log file I am processing grows very quickly, and it didnt keep up as well as I believe it should. My second idea was to use the truncate function and remove the line this way, however I have not been able to get it to work properly. My output is always the first line of my pattern match, then the rest of the file is truncated.
Im sure there is something simple I am missing - or perhaps there's a better way to go about accomplishing this task. Any feedback would be greatly appreciated.
Good judgement comes with experience. Unfortunately, the experience usually comes from bad judgement.