my $counter = 0; while(1) { print "Got an even number\n" if(($counter++%2) == 0); }