Enable error message in Perl like PHP

Solution:

Maybe you’re after CGI::Carp. This module lets you redirect errors and/or warnings to the browser window.

From the doco:

use CGI::Carp qw(fatalsToBrowser);
die "Fatal error messages are now sent to browser";