#!/usr/bin/perl use strict; no warnings; use Net::SSH::Perl; use constant HOST => 'localhost'; use constant USER => 'user'; use constant PASS => 'password'; use constant CMD => 'wc'; my $ssh = Net::SSH::Perl->new( HOST, protocol => 2, debug => 1, ); $ssh->login(USER, PASS); my $intext = 'X' x 10632; my ($stdout, $stderr, $exit) = $ssh->cmd(CMD, $intext); print "remote output is: ", $stdout, "remote stderr is: ", $stderr, "\n", "remote exit status is: ", $exit, "\n";