Multiple choice technology programming languages

package A; sub new { return bless {}, shift; } sub DESTROY { print ref(shift); } package B; use base 'A'; sub DESTROY { my \$self = shift; print ref(\$self); bless \$self, 'A'; } package main; my \$obj = B->new();

  1. BA

  2. AB

  3. Compilation Error

  4. Null point reference error

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

Perl's destructor (DESTROY) uses reverse order of inheritance. When $obj is destroyed, B's DESTROY runs first (prints 'B'), then it reblesses itself to class A. Then A's DESTROY runs (prints 'A'). The output is 'BA'. No compilation or runtime errors occur.