#!/usr/bin/perl use strict; use warnings; use Net::LDAP; my $ldap = (); sub bla { $ldap = Net::LDAP->new('ldap://xxx.xxx.xxx.xxx:xxx',onerror=>'die',) or die(); $ldap->bind('cn=xxxxxxx', password=>'xxxxxxx',); $ldap->unbind(); } sub blafu { $ldap->bind('cn=xxxxxxx', password=>'xxxxxx',); $ldap->unbind(); } &bla(); &blafu();