in reply to Counting iterations of 1 and 0

If value=1, run loop1test. else if value=0, run loop0test.
This is obviously not Perl code, but pseudo-code, so I will not offer to correct the syntax or anything, but I would suggest that you learn how to indent code correctly, so that indentation may be useful:
If value=1, run loop1test. else if value=0, run loop0test.
This makes clearer that you run loop1test if the value is 1 and that, else, if the value is 0, you run loop0test.