in reply to Remote server file access issue

In this case, you're doing some things which are actually pretty simple shell stuff. While [id://shmem] is correct that it can get tedious translating Perl to shell, his suggestion for creating a Perl shell seems a little like overkill here.

You should be able to get this to work as you intended by simply connecting to the remote host, then executing

@filecont = $telnet->cmd("grep -i '$contcheck' $directory/$checkfile") +; if (@filecont) { $status = 'FAIL'; } else { $status ='PASS'; }
No directory handles or evaluating each line of the file necessary, just ask the remote host to run the grep for you and react based on whether it found any matches or not.