title: How do I make a complex query with Perl's Net::LDAP?
body: <p>I'm having trouble running a complex query against our company LDAP server. I'm using the following Perl script:</p>
  
  <pre><code>use Data::Dumper;
  use Net::LDAP;
  
  die "Can't connect to LDAP-Server: $@\n" 
      unless $ldap = Net::LDAP-&gt;new( 'xLDAPx' );
  
  
  foreach my $filter ( 'ou=Personal', 'ou=BAR', 'ou=Personal,ou=BAR', 'ou=Personal,ou=FOO,o=FOO,dc=foo,dc=com' )
  { 
      $mesg = $ldap-&gt;search( base =&gt; "o=FOO,dc=foo,dc=com", filter =&gt; $filter );
      print Dumper($mesg), "\n\n";
  }
  </code></pre>
  
  <p>While the first two filters work (as in returning the expected values) the last and complex one doesn't. It returns an empty array. What really puzzles me is that exactly the same query string works when I use it with a tool like the Softerra LDAP Browser. </p>
  
  <p>I have also tried the same query using PHP's <code>ldap_search</code> &amp; co, no avail.</p>
  
  <p>Can somebody shed some light on this?</p>
  
  <p>Thanks for reading</p>
  
  <p>holli</p>
  
  <p>Edit:
  This is the structure of the server:</p>
  
  <pre><code>Server
      ou=FOO
          ou=...
          ou=Personal
              uid=something
  </code></pre>
  
  <p>I need a list of uids.</p>