in reply to Simple SSH based chat client

As long as this isn't Windows, perhaps Net::OpenSSH combined with Expect? (Note the former includes a section in the doc on how to work with the latter.)