#!/usr/bin/perl -w use strict; use List::Util qw(shuffle); while () { my @words = split; WORD: for my $word (@words) { my $offset = $word =~ /[\.\,]$/ ? 2 : 1; my @letters = split //, $word; my $numletters = @letters; next WORD if $numletters < 4; $word = join("", $letters[0], shuffle(@letters[1 .. $#letters-$offset]), @letters[-$offset .. -1] ); } print "@words\n"; } __DATA__ Down that path lies madness. On the other hand, the road to hell is paved with melting snowballs. Although the Perl Slogan is There's More Than One Way to Do It, I hesitate to make 10 ways to do something. And don't tell me there isn't one bit of difference between null and space, because that's exactly how much difference there is. Randal said it would be tough to do in sed. He didn't say he didn't understand sed. Randal understands sed quite well. Which is why he uses Perl. As usual, I'm overstating the case to knock a few neurons loose, but the truth is usually somewhere in the muddle, uh, middle. Of course, I reserve the right to make wholly stupid changes to Perl if I think they improve the language. #### Dwon that ptah leis msenads. On the oethr hand, the raod to hell is pvaed with mlinetg sblwlonas. Agohutlh the Perl Sgalon is Treeh's More Tahn One Way to Do It, I hasitete to mkae 10 wyas to do snmoiehtg. And dn'ot tell me there in'st one bit of diferefcne beweetn nlul and scpae, becasue ta'hts elxctay how much drcinefefe tehre is. Rdanal said it would be tough to do in sed. He dd'nit say he dd'int undatenrsd sed. Ranadl uenadnsdrts sed qitue wlel. Wchih is why he uess Prel. As uausl, I'm osvtneatirg the case to kocnk a few nurnoes lsooe, but the ttruh is uualsly semwerohe in the mdudle, uh, mldide. Of cusore, I reevsre the rhgit to mkae wohlly sptiud cgeanhs to Perl if I thnik they ivopmre the lgagunae.