Two things: First, you probably want to pass \@attrs or [ @attrs ] instead of what you've got. You might also need to set scope => 'sub' in the search attributes.
Second, I'd try a different strategy, using this idiom to run through the results of a search:
my $ldap_msg = $ldap->search( ... );
if ( my $code = $ldap_msg->code ) {
die "Error running search: ",
Net::LDAP::Util::ldap_error_text( $code );
}
while ( my $entry = $ldap_msg->shift_entry ) {
# use $entry
}
It's been a while since I used LDAP and I just cribbed this from SPOPS::LDAP, which I wrote when I was using LDAP :-)
Chris
M-x auto-bs-mode