in reply to Newbie Regex Problem

You need a non-greedy match:

if ($test =~ "LDAP://CN=(.*?),") {

(note the question mark)