The first thing that you should do is to add "use strict;" to your program, as well as turning on warnings, this will catch most of the variable creation and typo errors. I have rewritten part of your script to make it more perl-ish.

#!/usr/local/bin/perl -w use strict; my @attr_list = qw/ cn fonDeptName telephoneNumber l st fonManagerDN=cn /; # did you open the file? open LDAPFILE, ">ldap" or die "Can not create ldap"; # print column header print LDAPFILE "InputValue:", join(':', @attr_list), "\n"; close LDAPFILE; # ... # Set up a search pattern that will recognize any attribute. my $attrs = join '|', @attr_list; # <-- you probably want | instead o +f : ? # Create a hash with attribute names as search keys my %attrs = map { $_ => '' } @attr_list; # ... # ...

In reply to Re: pulling LDAP structure by Roger
in thread pulling LDAP structure by tux242

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.