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 Math::Matrix and Math::MatrixReal 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.

In answer to the input question, (and modifying an earlier answer) why not get your input as

Thank you very much for providing valuable suggestions, particularly about CPAN. The idea did not come to my mind before posting the question in Seekers of Perl Wisdom. I shall try to use Math::Matrix perl module.