Paul Harwood wrote:

> What would be the best method to parse the following DN? I just want the
> first part of this DN so I can create a server list into an array
> (EX-MSG-01, EXMSG-02 
>etc).CN=EX-MSG-01,CN=Servers,CN=foreignlocation,CN=Administrative
> Groups,CN=domain,CN=Microsoft
> Exchange,CN=Services,CN=Configuration,DC=company,DC=domain,DC=com
>
> --Paul

I'm nopt sure where you're getting your line, but I will assume that it's inside a 
loop that feeds the default scalar '$_".

Outside the loop:
my @servers;

inside:
$string =~ s/(.+?)\,.+$/$1/;  #? makes it *lazy* taking the first available match that 
includes all
                                 #prior elements.
push (@servers, $_);

Joseph



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to