in reply to Capture keypress while process running
This should get you started:
#! perl -slw use strict; use Term::ReadKey; while( 1 ) { my $key = ReadKey 0.1; print 'Got: ' , defined $key ? "'$key'" : ' nothing!'; } __END__ c:\test>"ReadKey(Term).pl" Got: nothing! ... Got: nothing! Got: ' ' Got: nothing! ... Got: nothing! Got: 'v' Got: nothing! Got: nothing! Got: nothing! Got: 'V' Got: nothing! ... Got: nothing! Terminating on signal SIGINT(2)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Capture keypress while process running
by jcsoybomb (Initiate) on Jul 31, 2009 at 18:18 UTC | |
by Anonymous Monk on Oct 05, 2013 at 22:13 UTC |