http://www.perlmonks.org?node_id=11132509


in reply to Re^2: do $n exist in grep?
in thread do $n exist in grep?

or even easier

DB<34> @a = qw/xxBxx yyAyy zzNzz/ DB<35> @N = map {/^..(A|B)./} @a DB<36> x @N 0 'B' 1 'A' DB<37>

Hint: m// returns an empty list if there's no match

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery