in reply to split problem when emptiness is a valid element

If you set the third parameter to split (LIMIT), to -1, then it will produce the trailing undef for you.

$s = 'A|B||||||||||||||||||||||||||||||||||||';; print join '-', split /\|/, $s;; A-B print join '-', split /\|/, $s, -1;; A-B------------------------------------

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.