my $result = $ldap->bind(); if ($result->code) { # This makes Net::LDAP get the server response die "An error occurred binding to the LDAP server\n"; }