use strict; ## obtain $LastPosition open(LOG, '/var/log/messages'); seek(LOG, $LastPosition, 0); while (my $line = ) { chomp $line; ## Process $line; } $LastPosition = tell(LOG); close(LOG); ## store $LastPosition