use strict; use Net::SSH::Perl; my $ssh = Net::SSH::Perl->new('localhost',debug => 1, protocol => '2,1'); $ssh->login('username','password'); my ($stdout, $stderr, $exit) = $ssh->cmd('cat /tmp/a 1>&2'); print $stdout . "\n"; print $stderr . "\n"; print $exit . "\n";