in reply to Randomize elements among several arrays, while maintaining original array sizes.
You have an elegant solution to your basic problem, but there is a "concept" issue that it may be helpful to sort out.
Wherever one has a bunch of things all the same one tends to use an array. That applies on many levels so, if you have a bunch of arrays all the same (as implied in this case) the first (and often correct) thought is 'use an array of arrays'. However that makes identification of the arrays difficult where there is some semantic meaning associated with each nested array. In that case, rather than using an array of arrays consider using a hash of arrays. The hash key becomes the "name" of each array so they are identified in a nice fashion where they need to be treated individually, but is is easy to deal with the whole collection in a uniform fashion.
For further reading see perldsc, perldata, perlref and perllol.
|
|---|