Look up File:Tail in perl, have used this a few times on different projects to automate tailing logs and carrying out a specific action for log output.
google ftp-upload-mon a project I uploaded to sourceforge which uses File:Tail to tail -f xferlogs