There is an eamil which fatlos anorud from time to tmie saying that, beacuse of the way the haumn brian redas wrdos as a wohle, taht the oderr of inividudal letetrs isn't taht imatrpont. The only caveat benig taht the the frist and lsat leettrs must be in the correct potision. Awyany, I thugoht I'd konck up a perl sprcit to test tihs, and what do you know, it works. But only to a pinot. The exmpale eaiml is clarely tuend, and any hrad to raed wrods seem to have been pleyad arnuod wtih. Tihs is more noibctale for the lngoer wdors, whree a two chaatrcer laed-in and lead-out smees to hlep maesivsly.

The oehtr thnig I noctied was that if you ceatre a new wrod afetr the shfulifng, then you only see that new word, wihch makes tngihs a bit cofnisung. Ejony.

PS. I wdolun't try and run peldroc thruogh it, that gets _very_ coufinsng.

#!/perl -w use strict; # shuffle function from List::Util sub shuffle (@) { my @a=\(@_); my $n; my $i=@_; map { $n = rand($i--); (${$a[$n]}, $a[$n] = $a[$i])[0]; } @_; } while (<DATA>) { my $line = $_; my $line_copy = $line; while ($line =~ m/(\w+)/g) { next if length($1) < 4; my $start_offset = pos($line) - length($1) +1; my $word_middle_length = length($1) - 2; # force two character lead-in and lead-out if ($word_middle_length > 4) { $word_middle_length -= 2; $start_offset++; } my $word_middle = substr($line, $start_offset, $word_middle_le +ngth); my $shuffled_word_middle = join('', shuffle( split(//, $word_m +iddle) ) ); substr($line_copy, $start_offset, $word_middle_length) = $shuf +fled_word_middle; } print $line_copy; } __DATA__ There is an email which floats around from time to time saying that, b +ecause of the way the human brain reads words as a whole, that the order of individual l +etters isn't that important. The only caveat being that the the first and last letters m +ust be in the correct position. Anyway, I thought I'd knock up a perl script to test + this, and what do you know, it works. But only to a point. The example email is clearly +tuned, and any hard to read words seem to have been played around with. This is more +noticable for the longer words, where a two character lead-in and lead-out seems to help + massively. The other thing I noticed was that if you create a new word after the +shuffling, then you only see that new word, which makes things a bit confusing. Enjoy. PS. I wouldn't try and run perldoc through it, that gets _very_ confus +ing.

In reply to Typoglycemia Fun by reasonablekeith

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.