local $SIG{__WARN__} = sub { my $msg = shift; print STDERR "*******\n"; print STDERR $msg; print STDERR "current DB record: id=", $x->[$dbc_id]\n"; }; ..code that might cause an WARNING follows... #### #!/usr/bin/perl -w use strict; $SIG{INT} = 'CtrlC'; for (1..10) { print "$_\n"; sleep(1); } sub CtrlC { print "CTRL-C seen and ignored!\n"; } __END__ Example run:... I am just hitting CTRL-C at various times... C:\TEMP>perl ctrlc.pl 1 2 3 CTRL-C seen and ignored! 4 CTRL-C seen and ignored! 5 6 7 CTRL-C seen and ignored! 8 9 10