title: Perl Array dereference not working properly while passing it as an argument to a subroutine
body: <p>I am passing an array as ref to a sub. There I have to add values to it, but its not working. my code is:</p>
  
  <pre><code>my @scalarArray1 = ();
  
  sub CompareScalers() {
      fillScalarArray( $_[0], \@scalarArray1 );    #pass arrays by ref
  }
  
  sub fillScalarArray() {
      my $filename = $_[0];                        #first file name as input file
      open( my $fh, '&lt;:encoding(UTF-8)', $filename ) or die "Could not open file '$filename' $!";
      my @array = @{ $_[1] };
      while ( my $row = &lt;$fh&gt; ) {
          push( @array, $row );
      }
  }
  </code></pre>
  
  <p>The debug print at end of while loop for the size of arrays is as follows: </p>
  
  <pre><code> DB&lt;29&gt; p $#scalarArray1
  -1
   DB&lt;30&gt; p $#array
  1551
  </code></pre>