<?xml version="1.0" encoding="windows-1252"?>
<node id="1002816" title="Re: Is it possible to get the inverse of a square matrix to be input as a text file using STDIN?" created="2012-11-08 00:30:16" updated="2012-11-08 00:30:16">
<type id="11">
note</type>
<author id="880879">
space_monk</author>
<data>
<field name="doctext">
One of the things to learn about any programming language is that your problem has almost certainly been addressed in some way before, and in this case there are PERL CPAN libraries  like &lt;a href="http://search.cpan.org/~ulpfr/Math-Matrix-0.5/Matrix.pm"&gt;Math::Matrix&lt;/a&gt; and &lt;a href="http://search.cpan.org/~leto/Math-MatrixReal-2.09/lib/Math/MatrixReal.pm"&gt;Math::MatrixReal&lt;/a&gt; to avoid having to do any work. Using CPAN libraries also makes your code more maintainable as other people will have more chance of having come across the library concerned on CPAN than of understanding your custom code.

&lt;p&gt;In answer to the input question, (and modifying an earlier answer) why not get your input as
&lt;code&gt;
while (&lt;&gt;) do {
    push @m2, [ split /,/, $_ ];
}
&lt;/code&gt;
and then your script can get your input from any file or stdin....&lt;br/&gt;
e.g.
&lt;code&gt;
./myprogram.pl &lt; d1.txt
&lt;/code&gt;
&lt;/p&gt;</field>
<field name="root_node">
1002795</field>
<field name="parent_node">
1002795</field>
</data>
</node>
