I am new to Perl and I am going through this tutorial http://qntm.org/files/perl/perl.html
In any case, I am working on creating a package that will take in the matrix and will perform various basic operations (for example, Gaussian exception, rref, back sub, defimants, etc.). I have my own constructor that accepts a list of links, but I have some problems with blessing them, so I can access them later. My code is:
main.pl:
use strict; use warnings; use Matrix; my @list = ([1,1,1],[2,2,2]); my $matrix = Matrix->new(@list); $matrix->test();
Matrix.pm:
package Matrix; sub new(){ my $class = shift; my $self = []; my @params = @_; $self = \@params; print scalar @{$self->[1]};
I guess the problem is that the links referenced by $ self are not blessed, but I'm not sure how to do this. Any help would be appreciated.
thanks
source share