Q&A

Q1:When I print a list of lists with print "@LOL", it prints ARRAY(0×101210), ARRAY(0×101400), and so on. Why?
A1: With a normal array, print "@array" would print the elements of the array with a space between them. The print "@LOL" is doing just that, printing the array elements in @LOL. To print the components of each of the arrays in @LOL, you must use the technique described in the "Example: List of Lists" section earlier in this hour.
Q2:I tried to take a reference to a list by using $ref=\( $a, $b, $c) and ended up with $ref containing a reference to a scalar value instead of a list. Why?
A2: In Perl, \($a, $b, $c) is actually shorthand for (\$a, \$b, \$c)! What you actually wound up with is a reference to the last element in the parentheses, ...

Get Sams Teach Yourself Perl in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.