Well the OP had only one grouping and no /g modifier, such that it does the same thing.
DB<120> @a = map { /(\w*a\w*)/;$1||() } `ls`
=> (
"babel",
"emacs1000",
"lanx",
"lanx",
"seahorse",
"man",
"Tracker",
"virtual",
)
DB<121> @a = map { /(\w*a\w*)/ } `ls`
=> (
"babel",
"emacs1000",
"lanx",
"lanx",
"seahorse",
"man",
"Tracker",
"virtual",
)
update
FWIW: As already posted my approach to clarify whats happening is
map { my @matches = /.../ ; @matches } LIST or even map { my @matches = /.../ } LIST
Cheers Rolf
( addicted to the Perl Programming Language)
|