Multiple choice technology programming languages

What gets printed? my @a = ([1, 2, 3, 4], [5, 6, 7, 8]); print join(' ', @{$a[1]}[1..3]);

  1. 1 2 3

  2. 2 3 4

  3. 5 6 7

  4. 6 7 8

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

The code creates an array @a with two elements: $a[0] = [1,2,3,4] and $a[1] = [5,6,7,8]. The expression @{$a[1]}[1..3] dereferences $a[1](which is [5,6,7,8]) and slices elements at indices 1, 2, and 3, yielding (6, 7, 8). Joining these with spaces produces '6 7 8'. The key is understanding array slicing with [1..3] after dereferencing the inner array reference.