perl - handling sigint 
Write a small Perl program that waits for 30 seconds and exits with printing “Bye”. If interrupted by any key before 30 second then print “Hello” before exiting.

perl -e "$SIG{INT}= sub {print 'Hello';exit;};for ($i=0;$i<30;$i++){sleep 1;}; print 'bye';"

[ add comment ]   |  permalink  |   ( 2.6 / 122 )

<Back | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Next> Last>>