title: Error - 'global symbol requires explicit package name'
body: <p>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 : </p>
  
  <p>Global symbol "@ref_mat1" requires explicit package name at multiplication.pl line 49.</p>
  
  <p>Global symbol "@ref_mat2" requires explicit package name at multiplication.pl line 49.</p>
  
  <p>Below is my script : </p>
  
  <pre><code> #!/usr/bin/perl -w
      use strict;
  
       my @mat1=(
          [2,3,4],
          [1,2,3],
          [3,4,5]
              );
  
      my @mat2=(
              [2],
              [3],
              [4]
             );
  
  
      my ($i, $j, $k);
      my $r_product=[];
  
     $r_product= mat_multiplication(\@mat1,\@mat2);
  
      sub mat_multiplication
          {
  
           my ($ref_mat1,$ref_mat2)=@_;
           my($mat1_row,$mat1_col)=total_rows_column($ref_mat1);
           my($mat2_row,$mat2_col)=total_rows_column($ref_mat2);
               for($i=0;$i&lt;$mat1_row;$i++)
              {
                 for($j=0;$j&lt;$mat2_col;$j++)
                  {
                     my $sum=0;
                     for($k=0;$k&lt;$mat1_col;$k++)
                      {
                        $sum=$sum+$ref_mat1[$i][$k]*$ref_mat2[$k][$j];
                      }
                      $r_product-&gt;[$1][$j]=$sum;
                  }
              } 
              return $r_product;
  
          }
  
  
      sub total_rows_column
               { 
                my($r_mat) =@_;
                my $num_row=@{$r_mat};
                my $num_col=@{$r_mat-&gt;[0]};
                return($num_row,$num_col);
               }
  </code></pre>
  
  <p>I searched for this problem and found one link </p>
  
  <p><a href="https://stackoverflow.com/questions/3592770/explanation-of-global-symbol-requires-explicit-package-name">Explanation of &#39;global symbol requires explicit package name&#39;</a></p>
  
  <p>But still not able to resolve it. Please just have a look an let me know where am i doing mistake. </p>
  
  <p>Thanks</p>