http://www.perlmonks.org?node_id=168903


in reply to using split delimiters

You are correct. In this example the ?: is dumb. I can’t think of a case off hand where you would want to do that in a split, I don’t think one exists.... Other monks please correct me if I am wrong.
thanks ---Mogaka

Replies are listed 'Best First'.
Re^2: using split delimiters
by Aristotle (Chancellor) on May 24, 2002 at 05:29 UTC
    You may want to do it with something like /begin(?:block)?/ - note the question mark quantifier, or maybe in case of a backreference. I know I've needed this once or twice; it's not terribly common however.

    Makeshifts last the longest.

      If you needed it for a backreference though you'd use normal ( ) braces instead of the (?: ) braces seen here which are specifically intended not to store their results.

        Sorry, you are right of course.

        Makeshifts last the longest.