$ldap_host = "localhost"; $admin = "admin"; $domain = "nodomain"; $dn = "cn=$admin,o=$domain"; $password = "mypassword"; $ldap = Net::LDAP->new($ldap_host) or die "Could not establish connection to LDAP server - $ldap_host \n"; $ldap->bind($dn,password=>$password) or die "Could not bind to LDAP server - $ldap_host \n";