use Net::SSH::Perl; ($out, $err, $exit) = $ssh->cmd($cmd, [ $stdin ])