Thread schleifensteuerung: while-schleife per tastatur stoppen (8 answers)
Opened by achso at 2003-11-16 15:18

pq
 2003-11-16 17:14
#71892 #71892
User since
2003-08-04
12208 Artikel
Admin1
[Homepage]
user image
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
use Term::ReadKey;
$SIG{INT} = sub{ReadMode 0;exit;};
ReadMode 4;

while(1){
my $key;
 while (not defined ($key = ReadKey(-1))) {
   tu_was();
   sleep 1;
 }
 if ($key eq "q") {last;}
}
ReadMode 0;
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem

View full thread schleifensteuerung: while-schleife per tastatur stoppen