$ssh = Net::OpenSSH->new(host=>$host, user=>$user, password=>$pw) or die "can't :(\n" . $ssh->error; #### This method always succeeds in returning a new object. Error checking has to be performed explicitly afterwards: my $ssh = Net::OpenSSH->new($host, %opts); $ssh->error and die "Can't ssh to $host: " . $ssh->error; #### my $host = "username.example.com"; my $user = "username"; my $pw = "password";