http://www.perlmonks.org?node_id=1206972

echo 'authentication' | perl -F'' -lape '$_ = $F[0] . (@F-2) . $F[-1]'
Modified: added -a as advised by choroba
And like that ... he's gone. -- Verbal