in reply to split and capture some of the separators
The reason you're getting the zero-length elements is that you have two delimiters that follow eachother. Inbetween those delimiters there's nothing, and therefore you get a string holding nothing.
Example:
Step by step, it goes a little like this:$_ = 'XABX'; print "<$_>" for split /A|B/; __END__ <X> <> <X>
'X' . 'A' . 'BX' # 'A' matched. 'BX' # 'A' removed, 'X' returned. '' . 'B' . 'X' # 'B' matched. 'X' # 'B' removed, '' returned.
ihb
Read argumentation in its context!
|
|---|