It looks like you're just misusing the do BLOCK while EXPR structure. I think you just need to say while (EXPR) BLOCK and you'll be fine.
_____________________________________________________
Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart

In reply to Re: adding rank to a match in while loop. by japhy
in thread adding rank to a match in while loop. by BioGeek

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":