Update -- just realised that the code above goes into an infinite loop for words like, ironically, "loop" where the central part of the word is "unmangleable". Exercise for the reader.
Update -- Some very neat and very small solutions below, but just to restate, the code should mangle every word over three letters, but return them with the first and last letters in place. Except where the word is in the set of unmangleable words, which are four-letter words with double letters in the middle.
($_='kkvvttuubbooppuuiiffssqqffssmmiibbddllffss')
=~y~b-v~a-z~s; print