in reply to Numbering list items

I think you just forgot to reset "$no". Adding the single line
$no = 0 if /<n1>/;
at the end of the while loop might do it, if you can rely on the "<n1>" tag not being in the same F1 record as one of your "<item>" tags. If not, you will have to parse things a little finer, as in hsriram's example.