Q1: | When I print a list of lists with print "@LOL", it prints ARRAY(0x101210),ARRAY(0x101400), 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 wound up with is a reference to the last element in the parentheses, $c. To take a reference to an anonymous array, you should have used $ref=[$a, $b, $c]; instead. |
18.222.121.231