I suggest you use 'perl -d (yourscript.pl)' to take a look (>x $matrix_final) at what those two references are made of.
Once you do so, it will become apparent to you how to do all three of the things you want.
Both $matrix_final and $matrix transpose are simply references to arrays of arrays. The basic perldoc (perldsc I think) will show you how to do what you want to do... .

That should get you started. With a little work you will have what you want shortly...

Hope that is helpful...

Update:

Added link to perldsc to be a bit more helpful...

Update: rev b Looking at Math::MatrixReal it seems that most of what you want to do is actually supplied by the module...
It will be helpful to actually read that...
In particular, $new_matrix = Math::MatrixReal->new_from_string($string); This method allows you to read in a matrix from a string (for instance, from the keyboard, from a file or from your code).

...the majority is always wrong, and always the last to know about it...
Insanity: Doing the same thing over and over again and expecting different results...

In reply to Re: How to output matrix data from Math:;MatrixReal into a Hash or an Array by wjw
in thread How to output matrix data from Math:;MatrixReal into a Hash or an Array by John007

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.