In the following C# code:
int[] X = new int[2]; X[0] = 1; X[1] = 2; int[] Y = X; X[1] = 3;
After this executes, Y[1] will also be 3 since the o
Try doing this :
my @X = (1, 2); my $ref = \@X; # $ref in now a reference to @X array (the magic is `\`) $ref->[0] = "foobar"; # assigning "foobar" to the first key of the array print join "\n", @X; # we print the whole @X array and we see that it was changed