title: Is there a better way to pass by reference in Perl?
body: <p>I am doing pass-by-reference like this:</p>
  
  <pre><code>use strict;
  use warnings;
  
  sub repl {
      local *line = \$_[0]; our $line;
      $line = "new value";
  }
  
  sub doRepl {
      my ($replFunc) = @_;
      my $foo = "old value";
      $replFunc-&gt;($foo);
      print $foo; # prints "new value";
  }
  
  doRepl(\&amp;repl);
  </code></pre>
  
  <p>Is there a cleaner way of doing it?</p>
  
  <p>Prototypes don't work because I'm using a function reference (trust me that there's a good reason for using a function reference).</p>
  
  <p>I also don't want to use <code>$_[0]</code> everywhere in <code>repl</code> because it's ugly.</p>