in reply to list references
You can prove that it is a list of references to the contents of the array, not a reference to a list of copies:
@a = 1..3; # print a reference to each of the values print \$_ for @a; SCALAR(0x197c58c) SCALAR(0x197c598) SCALAR(0x197c5a4) # now the list of references - note the same addresses print for \( @a ); SCALAR(0x197c58c) SCALAR(0x197c598) SCALAR(0x197c5a4) ## And finally, modify (increment) the original values ## through those references. $$_++ for \( @a ); # And show the originals are modified. print "@a"; 2 3 4
|
|---|