in reply to Disabling keyboard input

You need to clear the input buffer before reading the next response.
Maybe this module does already cover all your requirements? IO::Prompter or Term:UI

Update: The following method clears the input buffer (at least on Unix):

use Term::ReadKey; sub flush_stdin { ReadMode 4; ReadLine(-1); ReadMode 0; } sleep 5; # type 'something' flush_stdin(); $|=1; print "---> "; chomp (my $answ = <STDIN>); print "answ: ($answ)\n"; # w/o 'something'

Update: Cannot test it under Windows, but maybe Win32::Console works (see Flush() method)?

Replies are listed 'Best First'.
Re^2: Disabling keyboard input
by hegotf (Novice) on Aug 09, 2011 at 18:55 UTC

    Thanks!

    I'm currently trying to explore this method although I'm not skilled enough yet, so it will take me some time

    Thanks again for your help!

Re^2: Disabling keyboard input
by hegotf (Novice) on Aug 09, 2011 at 16:36 UTC
    Thanks for your solution!

    Unfortunately, I use Windows and it doesn't work