in reply to Re^2: [bugs?] perldoc perlre, \G and pos()
in thread [bugs?] perldoc perlre, \G and pos()

Like I said, GIGO. You're trying to make it start and end at pos -1

An endless loop could only be a result of infinitely repeating matches not of the opposite.

I said it *thinks* it hasn't matched yet. A reasonable belief when pos == 0.

  • Comment on Re^3: [bugs?] perldoc perlre, \G and pos()

Replies are listed 'Best First'.
Re^4: [bugs?] perldoc perlre, \G and pos()
by LanX (Saint) on Sep 29, 2009 at 15:29 UTC
    And I said if it "*thinks* it hasn't matched yet" the while condition is false not true!

    Cheers Rolf

      1st Pass: It thinks it hasn't matched yet because pos == 0, so it matches, setting pos = 0.
      2nd Pass: It thinks it hasn't matched yet because pos == 0, so it matches, setting pos = 0.
      3rd Pass: It thinks it hasn't matched yet because pos == 0, so it matches, setting pos = 0.
      ...

        while() puts scalar context, so just _one_ try to match, and no match results in false!

        ...no repeated matches like in list context.

        Cheers Rolf