|Welcome to the Monastery|
A tiny correction: split doesn't return undef, it returns the empty list. Accessing [ (empty list) ]-> is what produces the undef.
The documentation of split also mentions this case:
Note that splitting an EXPR that evaluates to the empty string always returns the empty list, regardless of the LIMIT specified.
The problem is really that split is used for too many things, and it tries to cater to all needs.
A different way to approach this is not to ask what to split on, but ask what you want to extract. For example you can write
where .* matches every character up to (but excluding) the first newline.
Or explicitly state what you want removed:
In Perl 6, split is less magical, and you are encouraged to write patterns that match what you're after (and not patterns that match the separator, so that still works):
I'm not sure what else to write, since you didn't really have a question :-)