Just to elaborate a bit more on this, consider the code:
my @PP = ("foo", "bar", "baz");
my @OO = ("AAA", "bar", "CCC");
$PP[1][0] = "foobar";
What happens is that this does
not modify the
@PP array, instead it uses the value of
$PP[1] as an array reference which points to the global(/package) variable
@bar.
To make this a bit clearer:
#!/usr/bin/perl -l
my @PP = ("foo", "bar", "baz");
my @OO = ("AAA", "bar", "CCC");
$PP[1][0] = "foobar";
print "\@PP: " . join(", ", @PP);
print "\@OO: " . join(", ", @OO);
print "\@bar: " . join(", ", @::bar);
Output:
@PP: foo, bar, baz
@OO: AAA, bar, CCC
@bar: foobar
The '@PP' and '@OO' array are unmodified; the '@bar' array however was created.
With use strict; you get the error: Can't use string ("bar") as an ARRAY ref while "strict refs" in use