$array[0]="25 3 7"; #computed value 3*7=21 $array[1]="68 4 6"; #computed value 4*6=24; $array[2]="23 2 3"; #computed value 2*3=6; magic_sort(@array); #our to be determined sort function; #after our sort #$array[0] is "23 2 3"; #$array[1] is "25 3 7"; #$array[2] is "68 4 6";