... map will output a value for each input value it receives. If there is a match, $1 is returned. If the match fails, the value of the last expression evaluated
Not if you return an empty list (). The usual idiom is this:
my @map_some = map { /foo(bar)baz/ ? $1 : () } @all;(However, I'm apparently having a Copy/Paste-challenged day, so if you read my node within the first few minutes, it still would have had the OP's if conditional rather than the one I tested.)
In reply to Re^2: Assign result of map to scalar variable
by rjt
in thread Assign result of map to scalar variable
by ram31
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |