use strict; use Net::SSH2; my $ssh1= Net::SSH2-> new(); my $buf; $ssh1-> connect('ipaddress') or die "conncet to SSH1 failed"; $ssh1-> auth_password('user', 'pass') or die "auth1 failed"; my $chan1= $ssh1-> channel(); $chan1-> blocking(1); $chan1-> exec('uname'); $chan1-> read($buf, 100); print $buf, "\n"; $chan1-> close;