sub compare2records { my ($x, $y) = @_; # $x and $y are array refs to DB records my $result =0; #typical message might be.... #Argument "13ND" isn't numeric...blah...blah local $SIG{__WARN__} = sub { my $msg = shift; print STDERR "*******\n"; print STDERR $msg; #has a \n in $msg print STDERR "current DB record: id=", $x->[$dbc_id]; ...other complicated info for developers... print STDERR " other DB record: id=",$y->[$dbc_id],"\n"; print STDERR "*******\n"; }; ... complex comparisons happen here.... ... a non-numeric field in the DB that should be numeric will ... cause an error and will be intercepted by the SIGNAL handler ... these are messages intended for the develop team ... ... the user shouldn't see this, it means we screwed up on ... data validation and it is "our" problem, not a user ... problem! We have to fix code, this is past user has to ... fix his/her input! A user input error should not have ... gotten this far! }