## Use the fabulous CGI.pm module is usually installed use CGI; my $C = CGI->new(); ## create a code ref to the DIE event handler $SIG{__DIE__} = \&my_die; ## create a sub to handle the dies sub my_die { print $C->header,$C->start_html; print qq(

@_

); print $C->end_html; }