for (i = 0, i =< @#entries, i++) { $indexofleast = i; for (j = 1, j =< @#entries, j++) { if (@entries[j] lt @entries[i]) { $indexofleast = j; } if ($indexofleast != i) { $temp = @array[j]; $@array[j] = $@array[i]; $@array[i] = $temp; } } }