http://www.perlmonks.org?node_id=963212


in reply to Error while using stirct.

Error while using stirct
Your error isn't to do with using strict (or warnings) - if you turn off strict you will still get an error caused by the two problems highlighted below:
sub LDAPattrsearch { my ($ldap,$searchString,$Attrs,$base) = @_; if (!$base) { $base = "o=hostname.com"; } if (!$Attrs) { $Attrs = [ 'val1','val2','val3','val4']; } } # <---- THIS SHOULDN'T BE HERE AT ALL my $result = $ldap->search ( base => "$base", filter => "$searchString", attrs => "$Attrs" ); } # <---- AND THIS SHOULD GO AT THE END AFTER PRINT print "$result\n";