Create a column-first matrix
Let's create a column-first matrix.
use strict; use warnings; #Creating a column-first matrix sub mat_new { my ($values, $rows_length, $columns_length) = @_; my $mat = { rows_length => $rows_length, columns_length => $columns_length, values => $values, };; return $mat; } # Create a 3 row 2 column priority matrix # 14 # twenty five # 3 6 my $mat = mat_new ([1, 2, 3, 4, 5, 6], 3, 2); use Data::Dumper; print Dumper $mat;