in reply to "Round Robin" variable range?

You could also use the ternary operator:
my $i = 0; # ... somewhere in the code: $i = $i < 4 ? $i + 1 : 0;
The $i variable will cycle on 0, 1, 2, 3, 4, 0, 1, 2 ...