in reply to sorting of two perl arrays

Create an array of indices sorted by @b and then use it to reorder both arrays:

@a = (1,5,3);; @b = (5,2,1);; @sortedIndices = sort{ $b[ $a ] <=> $b[ $b ] } 0 .. $#b;; @a = @a[ @sortedIndices ];; @b = @b[ @sortedIndices ];; print "@a\n@b";; 3 5 1 1 2 5

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."