sub clean_stdin { eval{ local $SIG{ALRM}=sub{die()}; while(1) { alarm(1); getc STDIN; alarm(0); } }; alarm(0); }