in reply to Why repeated matches...

You get repeats because $1 is not reset on a failed match. Your code should be more like:
while (...) { if (some match) { do something with $1 } }

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.