I am trying to use a regex to return the text "MyPc" in the below example. Instead of getting just MyPc, I am getting "MyPc,OU=MyOu,DC=NyDomain". A quick hand would be greatly appreciated.
$test="LDAP://CN=MyPc,OU=MyOu,DC=NyDomain,DC=com";
if ($test =~ "LDAP://CN=(.*),.*") {
print "$1\n";
}