#!/usr/bin/perl use Term::ReadKey; $char='q'; while(1){ ReadMode ('cbreak'); if (defined ($ch = ReadKey(-1))){ #input was waiting and it was $ch if ($ch eq $char){exit(0);} }else{ # no input was waiting #your program goes here print "############################\n"; select(undef,undef,undef,.01); } ReadMode ('normal'); # restore normal tty settings } __END__