in reply to Don't understand behavior of this split
From perldoc -f split:
If the PATTERN contains parentheses, additional list elements are created from each matching substring in the delimiter. split(/([,-])/, "1-10,20", 3); produces the list value (1, '-', 10, ',', 20)
Try using the non-capturing parentheses(?:)
update: Boy you gotta type fast around here!
update: changes from 'pre' to 'code', cause square brackets were being misinterpreted
As Occam said: Entia non sunt multiplicanda praeter necessitatem.
|
|---|