sub mergeSort { #Takes reference to array, index to sort on, beginning index, and end index my ($aref, $index, $begin, $end)=@_; my $size=$end-$begin; if($size<2) {return;} my $half=$begin+int($size/2); mergeSort($aref, $index, $begin, $half); mergeSort($aref, $index, $half, $end); for(my $i=$begin; $i<$half; ++$i) { if($$aref[$i][$index] > $$aref[$half][$index]) { my @va=@$aref[$i]; my $v=$$aref[$i][$index]; @$aref[$i]=@$aref[$half]; my $i=$half; while($i<$end-1 && $$aref[$i+1][$index] < $v) { (@$aref[$i], @$aref[$i+1])= (@$aref[$i+1], @$aref[$i]); ++$i; } @$aref[$i]=@va; } } } # end sub #Sort by uptime mergeSort(\@data, 8, 0, scalar(@data)); #Sort by 3rd section of interface cx/x/UX mergeSort(\@data, 12, 0, scalar(@data)); #Sort by 2nd section of interface cx/X/ux mergeSort(\@data, 11, 0, scalar(@data)); #Sort by 1st section of interface CX/x/ux mergeSort(\@data, 11, 0, scalar(@data)); #### sub ASort { my ($aref, $index)=@_; for ($x=scalar(@$aref);$x>0;$x--){ for ($j=0;$j<$x-1;$j++){ if ($$aref[$j][$index]>$$aref[$j+1][$index]){ @temp=@$aref[$j+1]; @$aref[$j+1] = @$aref[$j]; @$aref[$j] = @temp; } } } } #Sort by uptime ASort(\@data, 8); #Sort by 3rd section of interface cx/x/UX ASort(\@data, 12); #Sort by 2nd section of interface cx/X/ux ASort(\@data, 11); #Sort by 1st section of interface CX/x/ux ASort(\@data, 11);