my $sr = ldapassert($ldap->search(base => "ou=People, $ourdn", filter => "(objectClass=person)" scope => "one"), "searching the LDAP server"); foreach my $entry ($sr->entries) { # Getting the first value of these attributes # If they don't exist, we may be trying to unref undef here... my $cn = ${$entry->get('cn')}[0]; my $uid = ${$entry->get('uid')}[0]; print "$uid: $cn\n"; }