in reply to "Round Robin" variable range?

You will find some ideas in A better (ie.more concise) way to write this?.

Like this:

my $i = 0; my $j = 1; for( 1..10 ){ ( $i+=1 ) %= 4; ( $j-=1 ) %= 4; printf "%d %d\n", $i+1, $j+1; }

Replies are listed 'Best First'.
Re^2: "Round Robin" variable range?
by Salamihawk (Initiate) on Feb 01, 2014 at 15:19 UTC
    Awesome, thanks guys, the code provided by kcott and hdb fit the bill for what I need. Thanks a lot!