#!/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 () { 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_length); my $shuffled_word_middle = join('', shuffle( split(//, $word_middle) ) ); substr($line_copy, $start_offset, $word_middle_length) = $shuffled_word_middle; } print $line_copy; } __DATA__ There is an email which floats around from time to time saying that, because of the way the human brain reads words as a whole, that the order of individual letters isn't that important. The only caveat being that the the first and last letters must 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_ confusing.