s*l 发帖数: 10 | 1 for example, in a for or while loop, if we want to advances to next iteration
only after a key is hit (can be any key). How to do it?
I try getc() like below,but it advances to next iteration only after hitting
the RETURN key
for (;;) {
....
$junk = getc();
....
}
Thanks |
p******f 发帖数: 162 | 2
Term::ReadKey
http://search.cpan.org/author/JSTOWE/TermReadKey-2.21/ReadKey.pm
【在 s*l 的大作中提到】 : for example, in a for or while loop, if we want to advances to next iteration : only after a key is hit (can be any key). How to do it? : I try getc() like below,but it advances to next iteration only after hitting : the RETURN key : for (;;) { : .... : $junk = getc(); : .... : } : Thanks
|
s*l 发帖数: 10 | 3 Is there any simple solution (eg. several lines of codes) rather than
downloading this Term::ReadKey modules?
【在 p******f 的大作中提到】 : : Term::ReadKey : http://search.cpan.org/author/JSTOWE/TermReadKey-2.21/ReadKey.pm
|
p******f 发帖数: 162 | 4
Term::ReadKey handles all the complex for you, so you can write several
lines of code to fulfill your task.
It is much difficult to do your own, but it is possible. check POSIX
module, and basically you write it as C code.
【在 s*l 的大作中提到】 : Is there any simple solution (eg. several lines of codes) rather than : downloading this Term::ReadKey modules?
|
w*******g 发帖数: 51 | 5 use ppm. it is a piece of cake.
【在 s*l 的大作中提到】 : Is there any simple solution (eg. several lines of codes) rather than : downloading this Term::ReadKey modules?
|
m*m 发帖数: 47 | 6 Try this:
open FH, "<&1" ;
$er = read FH, $in1, 1;
print $in1."\n";
iteration
【在 s*l 的大作中提到】 : for example, in a for or while loop, if we want to advances to next iteration : only after a key is hit (can be any key). How to do it? : I try getc() like below,but it advances to next iteration only after hitting : the RETURN key : for (;;) { : .... : $junk = getc(); : .... : } : Thanks
|
m*m 发帖数: 47 | 7 Try this:
open FH, "<&1" ;
$er = read FH, $in1, 1;
print $in1."\n";
iteration
【在 s*l 的大作中提到】 : for example, in a for or while loop, if we want to advances to next iteration : only after a key is hit (can be any key). How to do it? : I try getc() like below,but it advances to next iteration only after hitting : the RETURN key : for (;;) { : .... : $junk = getc(); : .... : } : Thanks
|