hi,

in a ldap script where I get a list of values of a multivalued attribute
like this:

@memberof = qw( cn=group1,cn=xxx,dc=domain,dc=tld
cn=group2,cn=xxx,d=domain,dc=tld etc etc) ;

I would like to use map to convert the list of elements to
@memberof = qw( group1 group2 group3 etc etc )

This is the code I have tried to capture the first string after the first
'=' in the $1 variable

@memberof = map { s/^cn=(.*),.*$/$1/g; $_ } @memberof;
    for ( @memberof ) {
        print "[$_]" . " " ;
    }

but this snippet strangely cuts the start and the end of every array
element beginning and end so I get this:

[group1,cn=xxx,dc=domain] [group2,cn=xxxx,dc=domain]

so it is obviously not working. Is there a way to do this with map or do I
just have to process the array in a for loop and fill a new array with the
values? Just curious

TIA,
--
Groeten,
natxo

Reply via email to