use Net::SSH::Perl; my ($host,$user,$pw) = @_; my $rc = 0; my $cmd = "ls"; my $ssh = Net::SSH::Perl->new($host); $rc += $ssh->login($user, $pw); my($stdout, $stderr, $exit) = $ssh->cmd($cmd); $rc += $exit; return $rc;