use strict; use warnings; use Term::ReadKey; ReadMode "raw"; #raw can capture ctrl + c while(1){ print "prompt>\n"; #sleep 30 seconds my $char = ReadKey 30; next if (! defined $char); if (ord $char == 3 ){ print "control + c\n"; last; } #check database #process image } ReadMode "restore";