in reply to how to make // not return what is in a parenthesis?

I can't reproduce your output, but are you looking for something more like:

while (/A(BC)?D/g) { push @matches, $1 if $1; }

Replies are listed 'Best First'.
Re^2: how to make // not return what is in a parenthesis?
by beanryu (Novice) on Aug 01, 2010 at 01:58 UTC
    actually I am just looking for a way to make // not return what is inside a parenthesis when I output its result to an array. Because I have (expr 1|expr 2) in the regex to match, it always out put (expr 1|expr 2) into the array even though I am using the parenthesis only because I have to use the | in there.