use Math::MatrixReal; # my matrix is below as input my $mref = [ [ '5', '4', '4', '2', '4' ], ]; my $matrix = Math::MatrixReal->new_from_rows( $mref ); print $matrix; # I want to convert above into below ( 5 Rows x 1 Column) # As I need this for later on to use for further multiplication purpose [ [ '5'], [ '4' ], [ '4'], [ '2'], [ '4'], ];