in reply to Re: Re: split loop error
in thread split loop error

I find it hard to believe there could be a bug in something so commonly used as "while (<>)" or in the assignment of a scalar from $_. If there were, all sorts of other things would be breaking.

The only thing that is slightly unusual about this split is the use of capturing parenthesis. Does the split still break if you take them out? (I know you need them to capture the angle brackets and what's inside them, but it might help to narrow down the bug if you tried that).

Replies are listed 'Best First'.
Re: Re^3: split loop error
by tpederse (Sexton) on Feb 03, 2003 at 15:06 UTC
    Thanks again for the feedback.

    I verified that the problem isn't really with the while (<>) type of idiom nor with the assignment of a scalar. As tall man suggests those are pretty common operations and it would be utter chaos if they broke like this. Why the error messages points to line 1 is yet another question.

    The problem is in the regex of the split statement. If I do as tall man suggests and remove the capturing parenthesis, the error continues. However, if I pare things down to ...

    @outLine = split(/(<.*>)/,$line);
    and this works as it should. Of course, this is not the same as what I want to do, but I think it helps to isolate the problem.

    So, I'm fairly near convinced there is a bug in the split regex handling of i386 multi thread. Am I missing something here?

    Thanks! Ted
      Alas for those who proclaim Death to Dot Star!

      I have no clue yet on why you are getting this bug, but I had another idea for a work-around. Can you make your expression non-greedy without it breaking?

      @outLine = split(/(<.*?>)/,$line);
      If that works, you at least have a work-around to split the line as you wanted until a real fix is found.

      Update: One more idea. Have you tried tracing the failing case by adding:

      use re 'debug';