Net::SSH2::Channel::exec does not capture the output of the remote command, it just launches it. You have to use the read method afterward to retrieve the output.
in reply to Unable to store the command output from Net::SSH2. Please help.
On Unix/Linux systems Net::OpenSSH is far easier to use. Or there is also Net::SSH::Any that can work on top of Net::SSH2 and provides a simpler to use API, though it is still not a mature module.