in reply to multiple conditions while loop

It also occurs to me that you could provide an arrayref of statement-handles to your routine.   Iterate over the list of handles in an outer for loop, then include within it the while loop that you already have.

This approach is painless:   the array merely contains a list of new references to what the existing statement-handle variables already refer to.