title: Can I pass arguments to the compare subroutine of sort in Perl?
body: <p>I'm using <code>sort</code> with a customized comparison subroutine I've written:</p>
  
  <pre><code>sub special_compare {
   # calc something using $a and $b
   # return value
  }
  
  my @sorted = sort special_compare @list;
  </code></pre>
  
  <p>I know it's best use <code>$a</code> and <code>$b</code> which are automatically set, but sometimes I'd like my <code>special_compare</code> to get more arguments, i.e.:</p>
  
  <pre><code>sub special_compare {
   my ($a, $b, @more) = @_; # or maybe 'my @more = @_;' ?
   # calc something using $a, $b and @more
   # return value
  }
  </code></pre>
  
  <p>How can I do that?</p>