exilepanda has asked for the
wisdom of the Perl Monks concerning the following question:

Hi monks,

I am make an typing speed test for our hr dept. This is an remake, but more complex, since this one is not simply for typing English. The previous one I had 3 threads, one for timer, one for keypress counter, and last is STDIN line for candidate to type.

But this time, we have Chinese(Big5/GB2312) chars ( or possibly Japanese later). So I couldn't simply count by keypressed. and I have no idea how to deal with the last line(stdin not entered) when the timer is done.

Wow! This one works... I simply flush an array per each enter pressed.. and capture the last line by your method..
However, could you explain a little more what magic is inside the Glib::Idle?... I don't even know where to find the documentation... @@"

Hi, see Glib MainLoop for the MainLoop documentation. Documentation is sparse, but essentially, it waits until the Glib eventloop is idle, before running the sub, so as not to interfere with it. It is seen used more when you try to use Glib or Gtk2 code from a thread. If you get into GUI's, you will often read about the thread safety of the GUI toolkit. Gtk2's thread safety is accomplished principally by only using Glib::Idle->add to access the main gui code from within the thread. Here are a couple of examples.

What's the difference between a 30 symbol Chinese text that takes a minimum of 60 keystrokes to input, and a 57 symbol english text that takes a minimum of 60 keystrokes? (don't forget punctuation and capitals!)

If you're counting keys pressed to determine the typing rate, does that mean that mashing the backspace, delete and shift keys before typing each line will win me a really high score?

Typing Chinese is actually quite different from English, because the same sequence of keys may match several Chinese characters. Usually user can select the right character from some pop-up. If OP not just count keystrokes, but also checks the input simple ReadKey won't help him.