#!/usr/bin/perl use Math::MatrixReal; use strict; my $mref = [ [ 1, 2, 3, 4, 5, 6 ], ]; my $matrix = Math::MatrixReal->new_from_rows($mref); my ($rows, $cols) = $matrix->dim(); for(my $currentcol = 1; $currentcol <= $cols / 2; $currentcol++) { $matrix->swap_col($currentcol, $cols - $currentcol + 1); }