seemingly something simple but I do not seem to get right.
my $array_ref = [
"cn=a,dc=domain,dc=tld",
"cn=b,dc=domain,dc=tld",
"cn=c,dc=domain,dc=tld",
"cn=d,dc=domain,dc=tld",
"cn=e,dc=domain,dc=tld",
"cn=f,dc=domain,dc=tld",
"cn=g,dc=domain,dc=tld",
"cn=h,dc=domain,dc=tld",
"cn=i,dc=domain,dc=tld",
"cn=j,dc=domain,dc=tld",
"cn=k,dc=domain,dc=tld",
"cn=m,dc=domain,dc=tld",
"cn=n,dc=domain,dc=tld",
"cn=o,dc=domain,dc=tld",
"cn=l,dc=domain,dc=tld",
];
my @values = map { s/dc=domain,dc=tld/dc=sub,dc=otherdomain,dc=tld/i;
+$_ } @$array_ref;
print $_, "\n" for @values;
So I want to substitute the regex "dc=domain,dc=tld" by "dc=sub,dc=otherdomain,dc=tld".
I get a list of 1s .... (so 1, 1, 1, ...).
Any help greatly appreciated.
Edit: solved, added $_ at the end of the regex.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.