Named Anonymous
@array []
%hash {}
####
@array;
####
[];
####
$arrayref = [];
####
$ary = $arrayref;
push @$ary,"foo";
print $arrayref->[0]; # prints "foo" \
print @$arrayref[0]; # prints "foo" - same pointer value in $ary and $arrayref
print $ary->[0]; # prints "foo" /
####
for("foo") {
print; # prints foo
undef $_; # dies with "Modification of a read-only value attempted"
# - literals cannot be modified
}
####
my $ref = ["my","list"];
####
for (@$ref) {
print;
$_ = undef;
}
# the [] array pointed to with the content of $ref is now [undef,undef]