in reply to Problem executing command via ssh

If you're on a *NIX system, I would definitely recommend using Net::OpenSSH instead. See its open2 and open3 methods.