Challenge 1: Catch a Division Error — Possible Solution ==================================================================== use strict; use warnings; use feature 'say', 'try'; no warnings 'experimental::try'; sub safe_divide { my ($a, $b) = @_; die "Cannot divide by zero\n" if $b == 0; return $a / $b; } try { my $result = safe_divide(10, 0); say $result; } catch ($e) { say "Caught: $e"; } Output: Caught: Cannot divide by zero WHY THIS WORKS AS AN ANSWER ------------------------------ safe_divide reuses Course 1's own argument-unpacking pattern (my ($a, $b) = @_;) and postfix-conditional die (die "..." if $b == 0;, from Course 1, Chapter 5), with the message ending in \n per this chapter's own explanation to suppress the automatic file/line location text — a clean, purely custom error message. try { ... } catch ($e) { ... } reuses this chapter's own modern error-handling syntax exactly, in the same shape as its own process_file worked example — the risky call, safe_divide(10, 0), sits inside the try block, and because it dies, control jumps straight into the catch block instead of continuing past it. $e inside catch reuses the chapter's own explanation that the caught error becomes available as a plain, safely-scoped variable — printing "Caught: $e" via string interpolation (Course 1, Chapter 2) shows the exact message safe_divide died with, "Cannot divide by zero" (with the trailing newline consumed as part of the string itself, so it reads cleanly on one line).