Fragment A below works, copying an array by dereferencing an array ref.
Fragment B, deeper in some real code, does not. The commented-out line is not part of the real code, which works fine (%ips is a hash in which each key is an IP address and each value is a reference to an array).
But why does the commented-out line fail with the message
Global symbol "$ips" requires explicit package name at ...
Fragment A:
my $a1 = [1,2,3];
say $$a1[1];
my @a2 = @$a1;
say "@a2";
Fragment B:
else {
# Initialise count to 1,
# set both dates:
$ips{$1} = [1, $2, $2];
# my @arr = @$ips{$1}; # error...
}