in reply to Net::LDAP doesn't return until end of loop
hmm, hard to say given the information. have you tried with just one mac address? what does your data look like? i notice you're not chomping the $mac. also, you have: my @attrs = ['username', 'plan', 'ipaddress']; when i think you want $attrs. (same in ldapsearch). does it print the $mac each time for $ldapsearch? try putting an else in the callback that prints something.. perhaps it's just not getting an entry for some reason.
HTH