Gnat53 has asked for the wisdom of the Perl Monks concerning the following question:
I'd like to sort it by $Institution and within that sort by $CourseNumber (and possibly other values). E.g. the array starts like:$courselist[$courseindex] = [$Institution, $CourseNumber, $Professor, +$CourseTitle, $Enrollment]
and I want it to end like this:$courseindex[0] = ["UM", "CS 34", ......] $courseindex[1] = ["AC", "PHIL 13", ....] $courseindex[2] = ["UM:, "BIO 567', ....]
I haven't been able to figure out how to do it.$courseindex[0] = ["AC", "PHIL 13", ....] $courseindex[1] = ["UM", "BIO 567', ....] $courseindex[2] = ["UM", "CS 34", ......]
(with various values for n) which worked for me in another program with a similar, but less complex problem, but in this one I'm getting this error message:@courselist = sort {$$a[n] cmp $$b[n]} @courselist;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: sorting an array of an arrays
by Tanktalus (Canon) on Aug 13, 2006 at 00:26 UTC | |
by rodion (Chaplain) on Aug 13, 2006 at 11:30 UTC | |
|
Re: sorting an array of an arrays
by bobf (Monsignor) on Aug 13, 2006 at 02:37 UTC | |
|
Re: sorting an array of an arrays
by friedo (Prior) on Aug 13, 2006 at 00:25 UTC | |
|
sorting homework?
by aufflick (Deacon) on Aug 13, 2006 at 07:01 UTC | |
|
Re: sorting an array of an arrays
by Gnat53 (Novice) on Aug 13, 2006 at 12:52 UTC | |
by ysth (Canon) on Aug 13, 2006 at 23:34 UTC | |
by aufflick (Deacon) on Aug 14, 2006 at 08:54 UTC | |
|
Re: sorting an array of an arrays
by imp (Priest) on Aug 14, 2006 at 02:23 UTC |