in reply to
Re^3: swap columns in a 2-dim array
in thread swap columns in a 2-dim array
Unless I am reading his code wrong, it is possible that a given column could be swapped twice and end up in it's original position.
OP uses a shuffled array of 12 different indexes, from which s?he takes six pairs. Each pair contains two different indexes; each index falls into one, and only one, pair; in few words, s?he builds a partitions of the original set into six pairs. Then, s?he performs a single swap using the indexes each pair, which means that each location is read and written exactly once.
I realise that by his original reading, swapping the order of a column twice, so that it ends up back in its original position, meets that criteria.
The OP is also claiming that this is not a homework, so I think that your interpretation is the only possible - that is, an interpretation which looks at the final result and not at useless, noisy intermediate steps.
Flavio (perl -e 'print(scalar(reverse("\nti.xittelop\@oivalf")))')
Don't fool yourself.