in reply to Re^2: Grabbing input - every char, not after <Enter>
in thread Grabbing input - every char, not after <Enter>

It works for me:
use Term::ReadKey; ReadMode 4; # Turn off controls keys while (not defined ($key = ReadKey(-1))) { # No key yet select undef,undef,undef,0.1; # sleep 0.1 secon +d } print "Get key $key\n"; ReadMode 0; # Reset tty mode before exiting
run that:
$ perl test.pl <press d> Get key d $
update: the while() look does take up a tremendous amount of CPU time, though, so I added the select() call

Replies are listed 'Best First'.
Re^4: Grabbing input - every char, not after <Enter>
by true_atlantis (Acolyte) on Sep 17, 2007 at 22:31 UTC
    im an idiot, was looking at Term::ReadLine... thanks