in reply to Re: Round robin processing
in thread Round robin processing

I tried a bit similar to 'slice.pl':

perl -wle 'use Data::Dumper; my @buckets; my $buckets = 4; @a = 1 .. 1 +4; push @buckets, [ grep defined, @a[ map { $_ * $buckets } 0 .. @a / + $buckets ] ] xor shift @a for 1 .. 1 + @a / $buckets; print Dumper( +@buckets )'
output:
Useless use of logical xor in void context at -e line 1. $VAR1 = [ 1, 5, 9, 13 ]; $VAR2 = [ 2, 6, 10, 14 ]; $VAR3 = [ 3, 7, 11 ]; $VAR4 = [ 4, 8, 12 ];
upd.Slightly changed a name of variable $bucket to $buckets.