in reply to LDAP data to csv

The data shown appear to be from an LDIF file, so I'm guessing you want to read from the file rather than from an LDAP server. The steps would be:

  1. Open and read LDIF file
  2. Manipulate data
  3. Write CSV file

I recommend using Net::LDAP::LDIF and Text::CSV_XS.

Once you have some code written people here will be happy to help you debug it.