in reply to Re^4: How to tail file on remote host
in thread How to tail file on remote host

Your code as given has syntax errors.

I don't see what purpose the ->clearerr call is supposed to serve, as the documentation says:

Clear the given handle's error indicator. Returns -1 if the handle is invalid, 0 otherwise.

So it would reset the error information, but that won't change neither the eof() status nor will it read additional lines if they've been added..

Again, as I already told you, the simple way is to just copy the remote file to your local machine and then treat the file as if it were a local file.