## Connect and bind to the server. $ldap = Net::LDAP->new("servername.com",port => 389,version => 3 ) or die $!; my $result = $ldap->bind("id=$uid, o=intra, ou=people, dc=xxxx, dc=xxx", password => $pswd); if ($result->code != LDAP_SUCCESS) { die $result->error(); # Authentication failed }