in reply to Newbie Regex Problem

* is greedy, which means it will match the longest substring it can. You can force * to be non-greedy by following it with ?
if ($test =~ m{LDAP://CN=(.*?),}) {

You'll also note I've taken out the last .*, as it serves no purpose and changed your string to a regexp.

See perlre and perlretut for more information.