🎴 Flashcard Mode

Java and Perl Programming Fundamentals

Card1 / 20
Mastered0
Review0
QuestionClick to flip

How many key-value pairs will the hash contain? my %hash = ( [1, 2] => 1, [1, 2] => 2 );

AnswerClick to flip back
A
2
💡 Explanation:

Each execution of the array constructor [1, 2] creates a new, unique array reference. When used as hash keys, these references stringify to distinct strings (like 'ARRAY(0x...)'), resulting in two separate key-value pairs in the hash.

Change Mode