Consider example(down) and complete the functions matAdd (matrix addition) and matMul (matrix multiplication) . Both functions have two parameters, which are the references to the two matrices to be added or multiplied. The function should return the resulting matrix. Assume that the functions always get valid matrices as input (the different row arrays have exactly the same number of elments, etc.). The dimensions of the supplied matrices for the operation (add or multiply), however, may make sense or not. Therfore, check, whether the operation makes sense; in case it does not make sense, write an error message to the output. Finally execute the prepared script and check whether your operations give the correct results.

A very quick search of CPAN finds Math::Matrix. It has an object oriented interface similar to what you want. I am fairly certain that a more diligent hunt would find others even more to your liking. Good Luck, Bill