sub INT_handler { # check for any unfinished jobs # close all files exit(0); } $SIG{'INT'} = 'INT_handler';