Multiple choice technology programming languages

What will be the output ? my $val = bless {}, 'MyClass'; print ref($val);

  1. TRUE

  2. MyClass

  3. 1

  4. Object Reference

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

In Perl, bless associates a reference with a class, making it an object. The ref() function returns the class name of a blessed reference. Here, an empty hashref {} is blessed into 'MyClass', so ref($val) returns 'MyClass'. TRUE would be from a boolean context, 1 is numeric truth, and 'Object Reference' is not what ref() returns for a blessed object.