Oct 14, 2017, 9:31 AM
Thanks. I knew that it was possible to define an array and after that taking a reference to it. But there is apparently no possibility to do the other way around. My example was only a small test to exemplify my question. You might have the reference because you get it as a parameter to a subroutine and, naively, it would have been convenient to have a name for the object referenced by the parameter inside the subroutine, which would avoid the need to use the dereference operator (->) everywhere.
Re: [BillKSmith] Dereference an array
Another question, closely related but not exactly the same if I put
Then I get "b". Once again a copy of the array is made. It seems that a new copy is made each time you assign something to a new name. Coming from Python, I would be tempted to use references only (in python, everything is a reference) to avoid unexpected copies. But maybe this is my python background...
my @list = ("a","b","c","d");
my @newlist = @list;
(This post was edited by Olive on Oct 14, 2017, 9:32 AM)