in reply to foreach (shenanigans)

That's because you have a foreach. That puts the match in LIST context; the match happens once, returning all the captured matches. That's why you get 8 times the same result. Change the foreach to while, and you get what you want.

Abigail

Replies are listed 'Best First'.
Re: Re: foreach (shenanigans)
by foxops (Monk) on Jan 14, 2003 at 23:40 UTC
    I considered a "while", I was just wondering why it (foreach) only evaluated one time... Thanks.
      I am going to guess with the while you neglected to add the g modifier to the regular expression, and thus it would have evaluated only once.

      update:misread the question. my err.

      -enlil