in reply to How to fix error: Modification of a read-only value
To reiterate, what I'd like to do is to sort @courselist by $courselist[n][0] (i.e. $Institution, and within that sort, by $courselist[n][1], i.e. $CourseNumber.foreach $try (@text){ $try =~/^(.*?)\|(.*?)\|(.*?)\|(.*?)\|(.*?)\|(.*?)\|(.*?)\|(.*?)\|(.*?) +\|(.*?)\|(.*?)$/gs or die "<br />problem with $try<br />"; my $Institution = $1; my $CourseNumber = $2; my $Professor = $3; my $Enrollment = $4; ........ if (!$CourseNumber && !$Institution){last;}; if ($CourseNumber ne $LastCourseNumber){ $courseindex = $courseindex + 1; $courselist[$courseindex] = [$Institution, $CourseNumber, $Professor, +$CourseTitle, $Enrollment]; }; $LastCourseNumber = $CourseNumber; }; @courselist = sort { $a->[0] cmp $b->[0] || $a->[1] cmp $b->[1] } @co +urselist;
and I want it to end looking like this:$courselist[0] = ["UM", "CS 34", "Smith", "34"] $courselist[1] = ["AC", "PHIL 13", "Barry", "45"] $courselist[2] = ["UM", "BIO 567", "Houlihan", "12"]
$courselist[0] = ["AC", "PHIL 13", "Barry", "45"] $courselist[1] = ["UM", "BIO 567", "Houlihan", "12"] $courselist[2] = ["UM", "CS 34", "Smith", "34"]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to fix error: Modification of a read-only value
by GrandFather (Saint) on Aug 13, 2006 at 22:12 UTC | |
|
Re^2: How to fix error: Modification of a read-only value
by graff (Chancellor) on Aug 13, 2006 at 23:29 UTC | |
|
Re^2: How to fix error: Modification of a read-only value
by shmem (Chancellor) on Aug 21, 2006 at 06:14 UTC |