Perhaps the backticked command is failing. Maybe you should use IPC::Open3 to keep track of both STDOUT and STDERR. Otherwise $? will give a clue as to whether it succeeded or not.

Another alternative is to use the Net::LDAP module, which allows you to perform LDAP queries directly from Perl. In this way you can see exactly where and when in fails, and also possibly tailor the search to return exactly what you need and not have to post-process the results of @cdsValues.