In C#, it is possible to create references to reference types:
SomeObject origObj = new SomeObject();
SomeObject objRef = origObj;
Both origObj and objRef refer to the same object.
Now, in perl:
my @arr = (1,2,3);
method(\@arr);
sub method
{
my $arr_ref = shift;
foreach my $element (@{$arr_ref})
{
#...
}
}
I want to work with "@myArr" inside the method, instead of having to cast each time : "@{$arr_ref}" - and to do this without creating a copy of the array (because my "@myArr = @{$arr_ref}" will create a copy).
To Summarize : how can I get "@myArr = @{$arr_ref}" without creating a copy?