title: Perl Modifying Reference Array via Push in Subroutine
body: <p>I have an array I want to modify in a subroutine. It gets passed in by reference as the second argument. It doesn't seem to get modified, since when I return, the length of the array is the same as the original value.</p>
  
  <p>Here's a snippet of what I did:</p>
  
  <pre><code>sub readLine
  {
      my @array = @{$_[1]};
      #Push value onto array
      push @array, $myvalue;
  }
  
  sub main 
  {
      my @array = ();
      #Pass by reference
      readLine($argument1, \@array);
  
      print @array; #Prints 0
  }
  </code></pre>
  
  <p>I'm new to Perl so please let me know if I'm doing this correctly. I read answers to similar questions and it's still not printing the correct value (1) for me. I have the latest version of Perl installed.</p>