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
You're using a reference in the C# program, but not in the Perl program. It works the same if you use a reference in Perl.
my $X = [ 1, 2 ];
my $Y = $X;
$X->[1] = 3;
print "@$Y\n"; # 1 3
or
my @X = ( 1, 2 );
my $Y = \@X;
$X[1] = 3;
print "@$Y\n"; # 1 3
You could also create an alias.
use Data::Alias qw( alias );
my @X = ( 1, 2 );
alias my @Y = @X;
$X[1] = 3;
print "@Y\n"; # 1 3