I'm still not sure what you're trying to do.. but you might want to checkout perldoc -q shuffle@b = ( @a, 11, 32 ); my ( @newa, @newb, @newc ); my @sizes = ( scalar(@a), scalar(@b), scalar(@c) ); my @where_to = qw/a b c/;
UPDATE I believe the op just now clarified what about something like this, using parallel assignment:use List::Util 'shuffle'; @shuffled = shuffle(@list);
use XXX; use List::Util; @a=qw/foo bar baz/; @b=qw/mickey/; @c=qw/x y z/; (@a[0..$#a],@b[0..$#b],@c[0..$#c]) = List::Util::shuffle(@a,@b,@c); XXX [\@a, \@b, \@c]'
In reply to Re: Randomize elements among several arrays, while maintaining original array sizes.
by EvanCarroll
in thread Randomize elements among several arrays, while maintaining original array sizes.
by BioNrd
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |