Challenge 1: Write and Use a Module — Possible Solution ==================================================================== # StringUtils.pm package StringUtils; use strict; use warnings; use Exporter 'import'; our @EXPORT_OK = qw(reverse_string); sub reverse_string { my ($text) = @_; return scalar reverse($text); } 1; # script.pl use strict; use warnings; use feature 'say'; use StringUtils qw(reverse_string); say reverse_string("Perl"); Output: lreP WHY THIS WORKS AS AN ANSWER ------------------------------ package StringUtils; with use strict; use warnings; reuses the chapter's own Utils.pm structure exactly, and the trailing 1; at the very end reuses this chapter's own required-true-value rule directly — omitting it would produce the exact "did not return a true value" error the chapter's warn-box describes. use Exporter 'import'; our @EXPORT_OK = qw(reverse_string); reuses the chapter's own opt-in exporting pattern precisely, listing reverse_string as available but not automatically imported — matching the chapter's own recommendation to prefer @EXPORT_OK over unconditional @EXPORT. reverse_string itself uses Perl's built-in reverse() function, forced into scalar context with scalar (Course 2, Chapter 2's own context- forcing tool) — reverse() reverses a STRING character-by-character only in scalar context; in list context it would instead reverse the order of a list of arguments, a genuine context-sensitivity example directly in the spirit of this course's own Chapter 2. use StringUtils qw(reverse_string); in script.pl reuses the chapter's own explicit-import call syntax, requesting specifically the reverse_string symbol — after which it can be called directly, with no StringUtils:: package prefix needed, correctly printing "lreP".