Challenge 2: Context-Sensitive Return — Possible Solution ==================================================================== use strict; use warnings; use feature 'say'; sub get_letters { my @letters = ('a', 'b', 'c'); if (wantarray()) { return @letters; } else { return scalar(@letters); } } my @all = get_letters(); my $count = get_letters(); say "@all"; say $count; Output: a b c 3 WHY THIS WORKS AS AN ANSWER ------------------------------ This reuses the chapter's own get_scores example structure almost exactly, with letters standing in for scores — wantarray() inside the subroutine checks how get_letters was actually called by whoever invoked it, per the chapter's own explanation, rather than the subroutine's own code deciding in advance what to return. my @all = get_letters(); assigns to an ARRAY, which puts the call in LIST context (Chapter 3's own context rules apply identically to subroutine calls, not just plain array assignment) — so wantarray() returns true inside the subroutine, and return @letters; hands back all three letters, which @all then receives in full. my $count = get_letters(); assigns to a SCALAR instead, putting the exact same call in SCALAR context — wantarray() now returns false, and return scalar(@letters); hands back the element count (3) instead of the letters themselves. The subroutine's own code never changed between the two calls — only the calling context did, and wantarray() is what lets the subroutine detect and respond to that difference, exactly the "context-sensitive return" the chapter names as Chapter 3's context theme "taken to its logical extreme."