Multiple choice technology programming languages

What will be printed by the code below? my @a = (0, 1, 2); my ($b) = @a; print $b;

  1. 0

  2. 1

  3. 0 1 2

  4. 2

  5. 3

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

The statement assigns a list to a list, evaluating the right-hand side in list context. The array elements are copied, and since the left-hand side lists only one variable ($b) inside parentheses, it receives the first element of the array, which is 0.