in reply to switching array entries

Or, in yet another way to do it, and assuming variable indexTo means the index position before the move (i.e. indexTo=4 means in front of the element that was the element with index 4 before the move):
splice(@array,$indexTo-($indexTo>$indexFrom),0,splice(@array,$indexFro +m,1));

CU
Robartes-