Net::Telnet can be made to work on top of Net::OpenSSH easily. It is explained in the module documentation. Though, note that Net::OpenSSH only works on Linux/UNIX systems.
Comment on Re: Changing a script from Net::Telnet to Net::SSH2
On Solaris you have to ensure that the OpenSSH client is installed. The one from SUNOracle is an old fork of the OpenSSH one that does not provide some features required by Net::OpenSSH.
Then, you will have to tell Net::OpenSSH where to find it. For instance:
my $ssh = Net::OpenSSH->new($host, ssh_cmd => '/opt/OpenSSH/bin/ssh');