Depends on the services the remote hosts offer and or what ports are open to you as external client. You might try Net::Rexec first, and otherwise, the SSH related modules might be helpful.
If Net::Rexec cannot connect, but you do have some ssh command, you could parse the output of