title: Array sorting in Perl
body: <p>I am new to Perl and stuck with a (likely simple) array sorting problem.</p>
  
  <p>I've inherited some Perl code that reads lines from a text file into three 1-D arrays (x,y,z). I'd like to be able sort these arrays using one of the dimensions as the key and reordering the other two dimensions to match.  </p>
  
  <p>For example, if my input is:</p>
  
  <ul>
  <li>@x = (1, 3, 2)</li>
  <li>@y = (11,13,12)</li>
  <li>@z = (21,23,22)</li>
  </ul>
  
  <p>and I sort by x, I'd like the result to be:</p>
  
  <ul>
  <li>@x = (1,  2, 3)</li>
  <li>@y = (11,12,13)</li>
  <li>@z = (21,22,23)</li>
  </ul>
  
  <p>I could merge the three 1-D arrays into a 2-D array if that makes life easier.</p>