$stuff =~ s/(frontStuff)(stuffToMove1)(middleStuff)(stuffToSwap2)(endingStuff)/$1$4$3$2$5/;