Challenge 2: List Context vs Scalar Context — Possible Solution ==================================================================== use strict; use warnings; use feature 'say'; my @nums = (1, 2, 3, 4, 5); my @copy = @nums; # list context my $count = @nums; # scalar context say "@copy"; say $count; # @nums is the identical expression in both lines — the difference in # result comes entirely from the context each assignment puts it in: # assigning to an array asks for "all the elements" (list context), # while assigning to a scalar asks for "how many elements" (scalar # context). Output: 1 2 3 4 5 5 WHY THIS WORKS AS AN ANSWER ------------------------------ my @copy = @nums; reuses the chapter's own list-context example exactly — assigning an array to another array variable puts @nums in list context, so @copy receives every individual element, all 5 of them, in order. my $count = @nums; reuses the chapter's own scalar-context example just as directly — assigning the SAME @nums expression to a scalar variable instead puts it in scalar context, so $count receives the element count (5), not any particular element's value. The explanation reuses the chapter's own core point word for word in spirit: nothing about @nums itself changes between the two lines — it's the exact same array, referenced identically. What differs is purely what's on the LEFT side of each assignment, since that's what determines whether Perl evaluates the array in list or scalar context. This is precisely the chapter's own framing: context is decided by "what's asking for the value," not by the value itself.