Never tried golfing before, it's fun! This looked like something that called for a regular expression. I've used reverse here to perform a pseudo shuffle:

Update: took out reverse in favour of a random shuffle

while (<DATA>) { $_=~s/([.,\s]*?)(\w{1})(\w+)(\w{1})([,.\s]*?)(?{$j=sub{$x=shift;for(1 +..50){$n=int(rand(length($x)-1));$x=reverse(substr($x,0,$n)).substr($ +x,$n);}return $x };$x=$j->($3)})/$1$2$x$4$5/g; print $_; } __DATA__ Down that path lies madness. On the other hand, the road to hell is pa +ved with melting snowballs. Although the Perl Slogan is There's More Than One Way to Do It, I hesi +tate to make 10 ways to do something. And don't tell me there isn't one bit of difference between null and s +pace, 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 un +derstand 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 t +he truth is usually somewhere in the muddle, uh, middle. Of course, I reserve the right to make wholly stupid changes to Perl i +f I think they improve the language.

Update: Slightly OT for perl, but IIRC, this phenomenon is theorised to derive from 'orthographic word recognition', recognising the entire word by it's overall shape. As long as the outline of the word is roughly the same, the brain can make a pretty good stab at recognising it. It will probably also be helped by a priming effect, whereby the words most likely to follow a given word will be more 'activated'. There's some research (somewhere that is, I'm trying to track it down) suggesting that the more different the outline is from the original (especially through the placement of rising and falling letters like p and l) the more difficult it will be to recognise.

--------------------------------------------------------------

"If there is such a phenomenon as absolute evil, it consists in treating another human being as a thing."

John Brunner, "The Shockwave Rider".


In reply to Re: Fun with words (Golf?) by g0n
in thread Fun with words (Golf?) by McDarren

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.