#!/usr/bin/perl my @cols = qw/0 1 2 3 4 5 6 7 8 9 10 11/; fys( \@cols ); my @nums = ( [qw/01 02 03 04 05 06 07 08 09 10 11 12/], [qw/01 02 03 04 05 06 07 08 09 10 11 12/], [qw/01 02 03 04 05 06 07 08 09 10 11 12/], [qw/01 02 03 04 05 06 07 08 09 10 11 12/], [qw/01 02 03 04 05 06 07 08 09 10 11 12/], [qw/01 02 03 04 05 06 07 08 09 10 11 12/], [qw/01 02 03 04 05 06 07 08 09 10 11 12/], [qw/01 02 03 04 05 06 07 08 09 10 11 12/], [qw/01 02 03 04 05 06 07 08 09 10 11 12/], [qw/01 02 03 04 05 06 07 08 09 10 11 12/], [qw/01 02 03 04 05 06 07 08 09 10 11 12/], [qw/01 02 03 04 05 06 07 08 09 10 11 12/], ); for( my $i = 0; $i < 12; $i++) { for( my $j = 0; $j < 6; $j++) { ($nums[$i][ $cols[$j] ], $nums[$i][ $cols[$j+6] ]) = ($nums[$i][ $cols[$j+6] ], $nums[$i][ $cols[$j] ]); } } &printit; sub printit() { for( my $i = 0; $i < 12; $i++) { print "@{ $nums[$i] } "; print "\n"; } } sub fys { my $arr = shift; my $i; for( $i = @{ $arr }; $i--;) { my $j = int rand ($i + 1); next if $i == $j; @$arr[$i,$j] = @$arr[$j,$i]; } }