I got a Dvorak keyboard for Christmas this year. It came with a typing tutor, but it didn't give me the type of real-world practice that I needed. So I wrote this.

The "words" file is just linux's dict file, and the quotes.txt file is a list of about 5000 one-line jokes.
In addition to verifying the correctness of your keyboarding, it also times you, and gives you a rough count of your typing speed.

################################################ # # Typing Tutor # # Throws up random words or quotes, # and then checks the re-typing of them. # # v0.1 by Jeremy Gross, jeremy@cwes.net # ################################################ use Time::local; while (1) { print <<EOA; Typing Tutor -=-=-=-=-=-=-=-=-=-=- 1) Words 2) Quotes/Jokes 3) Exit EOA ; print "What'll it be? "; chomp( $choice = <STDIN> ); if ( $choice == 1 ) { print "\n\n\n"; Words(); } if ( $choice == 2 ) { print "\n\n\n"; Quotes(); } if ( $choice == 3 ) { exit; } } sub Words { MAIN: while (1) { open(WORDS, "words.txt") or print "Couldn't open word file: $!"; srand; rand($.) < 1 && ($line = $_) while <WORDS>; chomp $line; print "Word: $line\n"; print "Retype: "; chomp( $typed = <STDIN> ); if ( $typed eq "." ) { last MAIN; } elsif ( $typed eq $line ) { print "Good!\n\n"; } else { print "WRONG!!!\n\n"; push (@wrong, $line); } close(WORDS); } } sub Quotes { $totalsecs = 0; $totalwords = 0; $totallines = 0; MAIN: while (1) { open(QUOTES, "quotes.txt") or print "Couldn't open quotes file: +$!"; srand; rand($.) < 1 && ($line = $_) while <QUOTES>; chomp $line; $time1 = localtime; @fields1 = split(/\s+/, $time1); # print "$fields1[3]\n"; ($hour,$min1,$sec1) = split(/:/, $fields1[3]); print "Word: $line\n"; print "Retype: "; chomp( $typed = <STDIN> ); $time2 = localtime; # print "$fields2[3]\n"; @fields2 = split(/\s+/, $time2); ($hour,$min2,$sec2) = split(/:/, $fields2[3]); $sec1 += $min1 * 60; $sec2 += $min2 * 60; $SEC = $sec2 - $sec1; if ( $typed eq "." ) { last MAIN; } elsif ( $typed eq $line ) { print "Good!\n"; $totalsecs += $SEC; @temp = split(/ /, $typed); $totalwords += scalar @temp; $wpm = ($totalwords / ($totalsecs / 60)); print "Time: $SEC seconds Average: $wpm Words/Minute\n\n"; } else { print "WRONG!!!\n"; $totalsecs += $SEC; @temp = split(/ /, $typed); $totalwords += scalar @temp; $wpm = ($totalwords / ($totalsecs / 60)); print "Time: $MIN:$SEC Average: $wpm Words/Minute\n\n"; push (@wrong, $line); } close(QUOTES); } }

In reply to Typing Tutor by spacewarp

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.