sub sort_arr { my @h = map -s, @all; @results = @all[sort {$h[$a]<=>$h[$b]} 0..@h-1]; }