For starters, you could rewrite it to use
File::Tail instead of using
tail externally. That might help a bit. I suspect the entire log file is being buffered somewhere.
Update: Now that I actually *read* the code, I see some problems... the
s/........//; is kinda odd... I'm not sure what the author is trying to accomplish, but that will just delete 8 (probably the first 8) characters from each line (maybe he wanted to eliminate literal ........ -- hard to say, and I've never seen that in my logs). If he's trying to delete 8 characters, a substr would be much easier. In fact,
unpack might make this thing work better. The biggest thing I see, though, is that all variables are global, so they'll always be in scope. Especially with the variables in the while loop, if you make them local (with
my), they'll be destroyed on every iteration, and that might just save you some memory when there's no new line to process. That script is really ugly 8-(. I might try to rewrite it myself later this week if no one else is interested.
--isotope
http://www.skylab.org/~isotope/