in reply to data comparison
That usually occurs when you're putting an undefined variable into a string. Perl deals with this nicely and just puts a null string '' for you, but it's a warning that you probably have something wrong in your code. There's usually a line number along with that message -- check that part of your code.
I have a few suggestions for you that will probably help you in your quest to become a better developer.
So you called this function to get a list of entries, put it into an array, and in the very next step you start stepping through that array. That's a memory expense that you don't need. Instead,my @entries = $return->entries; foreach my $entry (@entries) { ..
will do exactly the same thing.foreach my $entry ($return->entries) {
Your approach to the problem makes sense -- you want to scan three servers and find all occurrences of the 1000 users. But you appear to be collecting that information as you go, rather than outputting it as you find it. Why is that?
I would suggest you use a hash of hashes (HoH) to group your users together -- so you'd have the names grouped together by first letter -- and then search as you've done on the same first letter, and check each entry to see if there's a match. The CPAN page on Net::LDAP says that you can use a callback function, so that might be a timesaver -- you can search for the users, specify a callback function and have that function stuff the matches into an array; once you return from the search, dump out the array of matches, and go on to the next letter. You can even limit the number of matches during your development, so as to not load up this Production machine.
|
|---|