I am new to Perl and stuck with a (likely simple) array sorting problem.
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.
For example, if my input is:
- @x = (1, 3, 2)
- @y = (11,13,12)
- @z = (21,23,22)
and I sort by x, I'd like the result to be:
- @x = (1, 2, 3)
- @y = (11,12,13)
- @z = (21,22,23)
I could merge the three 1-D arrays into a 2-D array if that makes life easier.