in reply to strange LDAP bust

It may reach the "test" output but because of buffering you'll never see it. Set $|=1 for the STDOUT filehandle or use print "test\n"; instead (Outputting a newline often flushes the output buffer)

That said, I think your problem is elsewhere than the chomp