my $message = sprintf "There was an error ['%s'] in the insert", $dbh->errstr; # Print the message with the file and line number included print Carp::shortmess($message); # Print the message with the stacktrace included print Carp::longmess($message);