Link to home
Start Free TrialLog in
Avatar of winmeister
winmeisterFlag for Italy

asked on

Sorting a multi-dimensional array

My array is made by n rows and 9 columns, and I need to sort the whole array with ref to the 5th column (id=4).

How?

ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of winmeister

ASKER

the unsorted array is @array, but what are $a and $b?
Perl's sort operator can take a comparison function as one of its parameters, in case you want something other than the default lexical sort. The $a and $b are variables with which the comparison function is called containing the left hand side and the right hand side, respectively. It's a convention left over from very early versions of Perl.