Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: How fast do I type?

by monkeygirl (Pilgrim)
on Sep 10, 2001 at 21:37 UTC ( [id://111517]=note: print w/replies, xml ) Need Help??


in reply to How fast do I type?

The standard method for calculating words for the purpose of finding WPM is counting all the characters and dividing by six. Why six? Because the average word is 5 characters long, plus a space.

I'm really no good at one-liners or golfing, but I quickly modified your code. It obtains the accuracy you're looking for. Tested on ActivePerl Build 629 (Perl v5.6.1).

#!perl $x=time; $letters=scalar(split//,<>)/6; print $letters/(time-$x)*60;

Sarah
If Bill Gates can name a company after his "bedroom" problems, I can have a stupid sig that points it out.

Replies are listed 'Best First'.
Re: Re: How fast do I type?
by foogod (Friar) on Sep 10, 2001 at 23:37 UTC
    golfed .... with line breaks and prefix
    perl -e'$x=time;print "WPM:".(scalar(split//,<>)/6)/(time-$x)*60."\n"'
      subtract ."\n" and add e (thanks once again to chipmunk)
      perl -le'$x=time;print "WPM:".(scalar(split//,<>)/6)/(time-$x)*60'

        for efficiency:

        perl -le'$x=time;print "WPM:",(scalar(split//,<>)/6)/(time-$x)*60'

        :)

        nice! ... forgot about the results of a -e modifier ...

        thanks,

        - f o o g o d

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://111517]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2024-04-18 07:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found