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

In Perl, object attributes stored in a hash reference are accessed using the arrow operator '->' followed by the key in braces, as in $kansas-&gt;{"capital"}.