🎴 Flashcard Mode

Mixed Programming Languages: Java, .NET, and Perl

Card1 / 20
Mastered0
Review0
QuestionClick to flip

What will be output ? my $val = 'x'; print ref($val);

AnswerClick to flip back
A
Empty Value
💡 Explanation:

In Perl, the ref function returns an empty string when the variable passed to it is not a reference. Since $val is a plain string scalar, ref($val) evaluates to an empty string ('Empty Value', 596740) rather than throwing an error or returning a label like SCALAR.

Change Mode