To be able to help you, I need more specific information:
- the output of the following line after the first search: $conn->printError() if $conn->getErrorCode();
If there's no output, then also put it into the loop where you are fetching the entries.
- which LDAP Server you use (also which patch level; e.g. IBM Tivoli Directory Server 5.2 without patches sometimes behaves strange)
- see some code, especially the connect/bind and search properties.
perl -e "s>>*F>e=>y)\*martinF)stronat)=>print,print v22.214.171.124.11.32"