The difference is context, scalar vs. list.
The m// operator returns the empty list on no match in list context and the list (1) in list context when there are no () in the regex.
So after evaluating all the matches in @list you are left with ((1), (), (1), (1)), which evaluates to (1,1,1).
|Replies are listed 'Best First'.|
Re^2: I was expecting 4 elements in the array, but it only has 3
by haukex (Archbishop) on Nov 28, 2018 at 17:13 UTC