programming-examples/perl/SystemFunction/alarm(5).pl
2019-11-15 12:59:38 +01:00

10 lines
185 B
Perl

print "Type something...\n";
local $SIG{ALRM} = sub { print "Sorry, timed out.\n"; exit; };
alarm(5);
while(<>) {
print "Thanks, please type again...\n";
alarm(5);
}