in reply to Active Directory DC and OU

Each directory can have multiple DCs and OUs, so presumably you want that info for a particular entry or entries.

I'm not running AD here so I can't test this. Here is an offsite link (sorry) to an article on that gives what appears to be a good example.

Most perl programs for LDAP use Net::LDAP so look at the module, the examples that come with it as well as Net::LDAP:FAQ which, IMHO, is really good.

HTH, --traveler