# Bind to LDAP Server $ldap = Net::LDAP->new( $ldapServer ) or die "$@"; $bind = $ldap->bind( $ldapUser, password => $ldapPass ); # Connect to SQL Server $connect = Mysql->connect($sqlServer, $sqlDB, $sqlUser, $sqlPass); $connect->selectdb($sqlDB); $ldapResult = $ldap->search( base => $ldapBaseOU, filter => "(&(usertype=Employee))", attrs => @ldapAttrs ); $sqlQuery = "SELECT username,email,phone FROM users"; $sqlResult = $connect->query($sqlQuery); print $sqlResult; my @entries = $ldapResult->entries; my $entry; foreach $entry ( @entries ) { my $username = $entry->get_value ( 'sAMAccountName' ); my $dn = $entry->dn; ### ***** Insert Match Here ***** ### $phone = ?? $email = ?? } # Unbind from LDAP Server $bind = $ldap->unbind;