I would consider this a bug, either in the documentation (for not documenting what happens if you combine both capturing and noncapturing components in the split PATTERN)
From perlfunc 5.8.0:
As with regular pattern matching, any capturing parentheses that are not matched in a "split()" will be set to "undef" when returned: @fields = split /(A)|B/, "1A2B3"; # @fields is (1, 'A', 2, undef, 3)
ihb
Read argumentation in its context!
In reply to Re^5: split and capture some of the separators
by ihb
in thread split and capture some of the separators
by shemp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |