I am trying to write a function to sort multiple columns of data in a cgi script, however, I am not having any success.
the function I am using is as follows:
and the data array looks like the following, with each line representing one element of the array in @assignment...
I am trying to be able to sort by the first or fifth column, among others, but the code I have written above has no effect on the array.
Not sure what exactly what is wrong, or right for that matter.
ANy help appreciated,
Jeff
the function I am using is as follows:
Code:
@ass_temp = sort {
(split '\|', $a, 1)[2] cmp
(split '\|', $b, 1)[2]
} @assignment;
@assignment = @ass_temp;
Code:
31|accounting|8/18/2006|c|10113|robert trigg||2|
32|accounting|8/21/2006|c|19654|13007||2|
33|accounting|8/21/2006|c|2047|steve||2|
35|accounting|8/21/2006|c|9000|macray||2|
36|accounting|8/21/2006|c|23892|calvin|rush|2|
37|accounting|8/21/2006|c|30006|JAMES||2|
38|accounting|8/22/2006|c|11184|sonny|rush|2|
I am trying to be able to sort by the first or fifth column, among others, but the code I have written above has no effect on the array.
Not sure what exactly what is wrong, or right for that matter.
ANy help appreciated,
Jeff