my @nums= ; my @index= sort { $nums[$a-1] <=> $nums[$b-1] } 1..@nums; print join "\n", @index, ''; #### 1 2 4 3 5