in reply to Split a string with multiple trailing delimeters?

If you use the third split parameter it will do the trick. A value of 5 works for your example, but any value larger also works which is useful if you are not sure how many fields there are:

print "'$_'" for split '[*]{2}', $s, 100;; '123' 'abc' '' '' ''

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: Split a string with multiple trailing delimeters?
by Fletch (Bishop) on Jan 04, 2011 at 18:47 UTC

    Actually a negative limit works as an infinitely large value and you don't have to worry about that one edge case n years down the road that surpasses what you've chosen that usually is large enough.</nit>

    Quoth the docs for split:

    If LIMIT is negative, it is treated as if an arbitrarily large LIMIT had been specified.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Re^2: Split a string with multiple trailing delimeters?
by haolecoder (Initiate) on Jan 04, 2011 at 18:57 UTC
    Using the third parameter worked. Thank you very much!