Perl Basics   «Prev  Next»

Perl Array References - Quiz

1. Given this code fragment, answer the questions below: $fooref = [ 'foo', 'bar', 'baz' ]; $arrayref = [ 'one', 'two', [ 'a', 'b', $fooref ], 'four' ]; How would you get the value 'b' from $arrayref?
Please select the best answer.
  A. arrayref->[2][1]
  B. #arrayref->[1]
  C. $$arrayref[2][1]

2. The $arrayref->[2] is an anonymous array:
Please select the best answer.
  A. true
  B. false
  C. Maybe

3. What value would this expression return? $arrayref->[2][2][2]
Please select the best answer.
  A. 'baz'
  B. 'bar'
  C. 'foo'