in reply to "Round Robin" variable range?
range operator loops
my $whatever = 1; while( $whatever ){ for my $ix ( 1 .. 4 ){ ... } }
modulus operator "cycle" through array
sub make_rollover { my( $completion_list ) = @_; my $ix = -1; my $xx = @$completion_list - 1; sub { $ix++; return $completion_list->[ $ix % $xx ]; }; } my $rollover = make_rollover( \@tlud ); while ( my $next = $rollover->() ){ ... }
There may exist helper modules on cpan to embody these type of ... algorithm loops ...
Buy, sell, self, sleep, me :Drooooool
|
|---|