#!/usr/bin/perl -w my $targetF = "/var/log/local2"; for(;;) { open ML, "<$targetF" || die $!; #seek(ML, 0, 2); # to EOF - Not, process from beginning for (;;){ while (){ another_line(); } sleep 2; seek(ML, 0, 1); # reset end-of-file error } # dropping here with the 'last' should cause # the file being monitored to be closed and reopened close (ML); } sub another_line { # $_ has the line # Check for target phrases return; }