Accdrnoig to rarcseeh at Cibmgdrae Unvsirteiy, it dsoen't mttear in waht odrer the ltteres in a wrod are, the only iaotnrmpt thnig is that the fisrt and last lteetr be at the rhigt pcale. The rset can be a total mess and you can sltil read it wothiut polerbm. This is busecae the hmuan mind does not raed evrey leettr by isletf, but the word as a wlohe.
Aoccdrnig to rsceearh at Cmabrigde Uinervtisy, it deosn't mttaer in waht oredr the ltteers in a wrod are, the olny iprmoatnt tihng is taht the frist and lsat ltteer be at the rghit pclae. The rset can be a total mses and you can sitll raed it wouthit porbelm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe.
sub permute ($) { my @text = split '', $_[0]; for (my $i = @text; $i > 1; $i--) { my $j = rand $i; @text[$i - 1, $j] = @text[$j, $i - 1]; } return join '', @text; } sub cambridge ($;$) { my $regex = defined $_[1] ? $_[1] : '(?<=[\w])([\w]{2,})(?=[\w])'; my @chunk = split /$regex/, $_[0]; for (my $i = 1; $i < @chunk; $i += 2) { $chunk[$i] = permute $chunk[$i] } return join '', @chunk; }