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
Comment on
Re: foreach (shenanigans)
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.
[reply]
Re: Re: Re: foreach (shenanigans)
by
Enlil
(Parson)
on Jan 14, 2003 at 23:45 UTC
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
[reply]
[d/l]
In Section
Seekers of Perl Wisdom