in reply to I was expecting 4 elements in the array, but it only has 3
According to List value constructors:
when a LIST is evaluated, each element of the list is evaluated in list context, and the resulting list value is interpolated into LIST just as if each individual element were a member of LIST.
It also says:
The null list is represented by (). Interpolating it in a list has no effect. Thus ((),(),()) is equivalent to ()
Paladin and haukex have already explained why m// is returning an empty list, but you can also check it by yourself in Regexp Quote Like Operators:
If the /g option is not used, m// in list context returns a list consisting of the subexpressions matched by the parentheses in the pattern, that is, ($1, $2, $3...) (Note that here $1 etc. are also set). When there are no parentheses in the pattern, the return value is the list (1) for success. With or without parentheses, an empty list is returned upon failure.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: I was expecting 4 elements in the array, but it only has 3
by AnomalousMonk (Archbishop) on Nov 30, 2018 at 03:43 UTC | |
by j41r (Beadle) on Nov 30, 2018 at 10:50 UTC |