title: How do I custom sort a 2D array in perl?
body: <p>I have a 2D array which I create like this:</p>
  
  <pre><code># i do this in a loop
  push @{ $list[$array_index++] }, ($x[0], $x[1], $x[2], $y);
  </code></pre>
  
  <p>I tried writing the sort function for this array like this:</p>
  
  <pre><code>@sorted = sort {$a-&gt;[3] &gt; $b-&gt;[3]} @list;
  </code></pre>
  
  <p>but it doesn't seem to work.</p>
  
  <p>What I want to do is to sort the "rows" based on the value of the "third column" of each "row". How do I do it?</p>