Blame


1 1ddd2d4e 2023-09-10 jrmu #!/usr/bin/perl
2 1ddd2d4e 2023-09-10 jrmu
3 1ddd2d4e 2023-09-10 jrmu # How many different things do these expressions refer to? Draw a PeGS
4 1ddd2d4e 2023-09-10 jrmu # structure for each of these:
5 1ddd2d4e 2023-09-10 jrmu #
6 1ddd2d4e 2023-09-10 jrmu # $ginger->[2][1]
7 1ddd2d4e 2023-09-10 jrmu # ${$ginger[2]}[1]
8 1ddd2d4e 2023-09-10 jrmu # $ginger->[2]->[1]
9 1ddd2d4e 2023-09-10 jrmu # ${$ginger->[2]}[1]
10 1ddd2d4e 2023-09-10 jrmu
11 1ddd2d4e 2023-09-10 jrmu 1, 3, and 4 refer to the same thing. ginger is an array reference. Get the
12 1ddd2d4e 2023-09-10 jrmu 3rd element (index 2) from the array reference, then get the 2nd element
13 1ddd2d4e 2023-09-10 jrmu (index 1) from that array reference.
14 1ddd2d4e 2023-09-10 jrmu
15 1ddd2d4e 2023-09-10 jrmu In 2, ginger is an array rather than an array referen.