As the maintainer of Net::SSH, let me be the first to encourage you to look at alternate modules. Net::SSH was useful when written but is very much deprecated legacy code these days.
Net::OpenSSH looks like the best modern choice if you want to use the external ssh binary. Other alternatives worth noting are Net::SSH::Perl (perl reimplementation of the protocol) and Net::SSH2 (uses libssh2).