use Error qw(:try); try { `$create_script $input`; #code that might thrown an exception; return; } catch Error with { my $error_handler = shift; # Get hold of the exception object } exit;