in reply to Newbie Regex Problem

Alternately, aside from going non-greedy, you could specify more exactly just what it is you're looking for. Namely, that you only want non-comma characters:

if ($test =~ "LDAP://CN=([^,]*),") {