O'Reilly logo

Sams Teach Yourself Perl in 21 Days, Second Edition by Rafe Colburn, Laura Lemay

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Workshop

The workshop provides quiz questions to help you solidify your understanding of the material covered and exercises to give you experience in using what you've learned. Try and understand the quiz and exercise answers before you go on to tomorrow's lesson.

Quiz

1:Define the differences between lists, arrays, and hashes.
A1: A list is just a collection of scalars; an array is an ordered list, indexed by position; and a hash is an unordered list of key/value pairs, indexed by the keys.
2:What do each of these variables refer to?
$foo
@foo
%foo
$foo{'key'}
$foo[$key]
$foo{$key}
A2: The answers are

$foo is a scalar variable

@foo is an array variable

%foo is a hash variable

$foo{'key'} is the value that matches 'key' in the hash %foo.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required