in reply to do-while loop never exits

Just to re-emphasize... use strict and warnings.

warnings alone gives the following message:

Name "main::test" used only once: possible typo
While it does not tell you directly what your problem is, it does notify you that there is a problem.

You can also enable diagnostics to get a more verbose explanation of the message. Again, it doesn't help in this case, but it is helpful in other cases.

Please read: How do I compose an effective node title?