Multiple choice technology programming languages

What will be the value of $size after executing the following code?my @a = (0, 1, 2);$#a = 0;my $size = @a;

  1. undef

  2. 0

  3. 1

  4. 2

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

Setting $#a = 0 truncates the array to only its first element (index 0), removing all other elements. The array @a now contains only one element (0). When an array is assigned to a scalar in Perl, it returns the number of elements in the array, so $size = 1.