Here's your code in perl:
push(@{$groups[(($#files + 1) % $_)],$files[$_]) for (0..$#files);It's a bit hasty, but that doesn't matter because it won't work anyway. % 0 is an error in perl, not zero.
But I can't imagine any reason why you would want to do this. It isn't going to speed up loop operations across the whole collection, and it isn't going to help you to identify parts of the collection. The only thing i can think of is that you want to process the collection one chunk at a time, in which case there are much simpler ways to subdivide it.
Your syntax suggest a javascript or maybe C background. Have a look at perl's hashes (and hashes of hashes): you might be pleasantly surprised.
But perhaps i've misunderstood. What are you trying to do?<?p>
In reply to Re: two-dimensional arrays
by thpfft
in thread two-dimensional arrays
by Ras
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |