Since
ago

Ferreira's Home Page


Perl camel, from http://dev.perl.org

Perl Bit #3: Right? Rgiht?

Once I read that some researchers have found out that when reading, the first and last letters of words are the ones that count. It means you read the following piece of text without much hassle.

    I aslo beelive that, whlie lgagauens can have 
    eiiinecefcfs and dcieiifecens, the lnagauges telvsmeehs 
    are enleasstliy amroal. Lgnaugae is not the lveel at 
    wchih we shluod ecofnre "good tohtughs", if we wnat 
    our lagugane to be mxlamialy uesufl. You can't efncore 
    milroaty by sntyax. In Eslginh it is just as easy to say 
    "bsels you" as it is to say "fuck you". You may agure 
    taht in Perl it's eseair to use the vreb "besls" bsucaee 
    it's bilut-in, but in acautl fcat, Prel lets you dienfe 
    "fcuk" any way you coshoe. You can aslo "goto hlel" 
    if you lkie, wcihh wlil of cuosre work beettr 
    if you've dfneeid the leabl "hell".
(quote from "The Culture of Perl" by Larry Wall: http://www.perl.com/pub/a/1997/wall/keynote.html)

A short Perl script can help one play with this. Pick the permutation subroutine of Perl Bit #2, together with the following code

    sub shuffle {
        my $word = shift;
        if (length $word > 3) {
            my @word = split '', $word;
            @word = ($word[0], permutation(@word[1..$#word-1]), $word[$#word]);
            return join '', @word;
        } else {
            return $word;
        }
    }

    s/([[:alpha:]]+)/shuffle($1)/ge;
    print;
Stuff some lines of texts into a file, then invoke Perl over it:
    perl -n mix.pl < input.txt
and you can find out for yourself if the assertive at the start of this bit makes sense or not.

On my account, I think that it is clear that first and letter words are not the whole truth. If the text is rich with common words, the reading is facilitated. But rare and long words call for more careful reading and then one's mind can get confused with the shuffling of letters. I also found that it is much harder (for me, at least) to read a scrambled text in English (which is not my native language) than in Portuguese. So that immediate recognition is directly related to the skill of the reader.

KEYWORDS

typos; Perl 5