in reply to Exit status of Net::Telnet question

If you're using Bash or similar for the shell on the other end, how about doing:
my @result = $object->cmd('test -f foo.txt; echo $?')
Because in Bash $? holds the exit value of the last command, and test -f checks to see if the file given exists and is a regular file, $result[0] should contain either a 1 (file does not exist) or a 0 (file does exist). After you determine that, you can cat your file or display the appropriate error.

Replies are listed 'Best First'.
Re: Re: Exit status of Net::Telnet question
by JoeJaz (Monk) on Jun 23, 2003 at 14:17 UTC
    This is an interesting approach. I never actually thought to have the shell do the work. Thanks for the input.