in reply to Re: do $n exist in grep?
in thread do $n exist in grep?
I got the sense that you didn't want just the captured parts. But if you only need the $1 from each match,
map { /^..(A|B)./ ? [ $_, $1 ] : () } @a
simplifies to
map { /^..(A|B)./ ? $1 : () } @a
but you could also go a step further and simply use
map /^..(A|B)./, @a
(I added this to the original post to show the options in one place.)
Seeking work! You can reach me at ikegami@adaelis.com
|
|---|