S
spydox
This is NOT homework!
I want to comment out certain lines which immediately follow (as a
group) another line. I created a simple example:
$_ = 'ZBCAACBABE';
In English, for any group of A,B,or C's in any order, which follow a Z,
I want to preceed with ! . So in this example I want the regex to
produce:
Z! B! C! A! A! C! B! A! BE
I tried ?= but I don't see a way to make that work. I thought
s/(Z)(A|B|C)+/$1! $2/g;
might have a chance but it produced
'Z! BE'
I'm not sure I can explain that result.
If your suggestion involves a loop please dont make it, I know plenty
of ways to do that.
Thank-You
I want to comment out certain lines which immediately follow (as a
group) another line. I created a simple example:
$_ = 'ZBCAACBABE';
In English, for any group of A,B,or C's in any order, which follow a Z,
I want to preceed with ! . So in this example I want the regex to
produce:
Z! B! C! A! A! C! B! A! BE
I tried ?= but I don't see a way to make that work. I thought
s/(Z)(A|B|C)+/$1! $2/g;
might have a chance but it produced
'Z! BE'
I'm not sure I can explain that result.
If your suggestion involves a loop please dont make it, I know plenty
of ways to do that.
Thank-You