I am trying to write a script for matrix multiplication. Its just a basic program but I am not able to figure it out about the following error :
Global symbol \"@ref_ma
$ref_mat1
and $ref_mat2
are references to arrays. In Perl if you want to access a reference to an array you cannot use $reference[$idx]
directly -- you have to use the ->
operator after the reference like this: $ref_mat1->[0]
.
Without it Perl thinks that $ref_mat1[0]
refers to an array @ref_mat1
which doesn't exist. Yes, both $var
and @var
can exist at the same time with differing content, see this example:
use strict;
use Data::Dumper;
my $abc = 42;
my @abc = (1, 2, 3);
print Dumper($abc), Dumper(\@abc);