Multiple choice technology programming languages

Which statement will print the capital attribute of the $kansas object?

  1. print ("capital"=>$kansas);
  2. print {$kansas}=>(capital);
  3. print (capital)<={$kansas};
  4. print $kansas->{"capital"};
Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

To access a hash attribute (key) in Perl, use the arrow operator with the hash reference and the quoted key name: $hashref->{key}. The curly braces denote hash access, and the arrow dereferences the hash object.