I've been through the Perl Cookbook and Programming Perl trying to
figure this one out, now I'm ready for some help. I've been working
with Perl for years but I can't make heads nor tails out of the
explanations in either of these books on the subject of sorting. Sigh.
I have a simple two-dimensional array, call it @Weights. I think of the
first index as being the Row index and the second being the Column
index. Normally I'd access an entry thus:
$ItemWeight = $Weights[$row][$col];
I just want to sort the rows first by the first column, then by the
second column, etc for all the columns. In other words, this
arrangement:
Col #
R# | 0 1 2
------+----------
0 | 3 0 2
1 | 0 5 0
2 | 1 3 1
3 | 1 0 8
Should sort to this:
Col #
R# | 0 1 2
------+----------
0 | 0 5 0
1 | 1 0 8
2 | 1 3 1
3 | 3 0 2
Can someone show me a sample of some code? By the way the number of
columns is small and fixed, I can just hard-code that part of the
problem if I can just figure out the reference syntax I should use for
passing the comparator values to the sort function.
Thanks
--
Matt Noel [EMAIL PROTECTED]
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com