Math::Matrix returns an object, and you can use arrow syntax to access individual elements:
use strict; use warnings; use Data::Dumper; use Math::Matrix; srand(time); my $a = new Math::Matrix ([rand,rand,rand], [rand,rand,rand], [rand,rand,rand]); print Dumper($a); print $a->[0]->[0]; # get 1 element __END__ $VAR1 = bless( [ [ '0.83428955078125', '0.442596435546875', '0.792205810546875' ], [ '0.193817138671875', '0.21514892578125', '0.23980712890625' ], [ '0.09869384765625', '0.627197265625', '0.514892578125' ] ], 'Math::Matrix' ); 0.83428955078125

It is often helpful to look at the tests provided with the CPAN distribution to see example usage code (follow the MANIFEST link to the "t/" links). In this case, the tests do show how to access individual elements.

Super Search is another efficient way of finding answers with code samples:
accessing elements inside Math::Matrix


In reply to Re: Math::Matrix and getting matrix elements by toolic
in thread Math::Matrix and getting matrix elements by bobo

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.