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...