use Win32::Console; $keyboard = Win32::Console->new(STD_INPUT_HANDLE); $SIG{'INT'} = sub { print "Gotcha!\n"; exit 0 }; $| = 1; # autoflush input print("Press ctrl-C to exit\n"); while (1) { @in = $keyboard->Input(); print(chr($in[5])) if $in[1]; } #### @echo off perl sigint.pl