use Net::LDAP; # Make connection to LDAP server on Exchange Server # my ($ldap) = Net::LDAP->new($server, port => 389) || die "Unable to connect to $server: $@\n"; # If anonymous binding to LDAP connection, do not pass any parameters to bind(), # alternatively, $binddn = domain name, $password = password # $ldap->bind($binddn, password => $password) || die "Unable to bind: $@\n"; . . . $ldap->unbind();