VO
delete
говорят на элемент хэша или массива, а не на ключ.Size: a a a
VO
delete
говорят на элемент хэша или массива, а не на ключ.SZ
perl -Mstrict -Mwarnings -le 'my@a=0..9;for(0..$#a){delete $a[$_] if $_%3}print for @a
SZ
SZ
SZ
VO
SZ
VO
VO
my @list
SZ
SZ
my @list
SZ
my @list
AP
delete may also be used on arrays and array slices, but its behavior is less straightforward. Although exists will return false for deleted entries, deleting array elements never changes indices of existing values; use shift or splice for that. However, if any deleted elements fall at the end of an array, the array's size shrinks to the position of the highest element that still tests true for exists, or to 0 if none do. In other words, an array won't have trailing nonexistent elements after a delete.
WARNING: Calling delete on array values is strongly discouraged. The notion of deleting or checking the existence of Perl array elements is not conceptually coherent, and can lead to surprising behavior.
AP
VG
AT
VO
$x = \@list;
и $x = [@list];
?AP
$x = \@list;
и $x = [@list];
?perl -MData::Dumper -e 'my @list = (0..9); my $l1 = \@list; my $l2 = [@list]; push @list, 10; print Dumper { 1 => $l1, 2 => $l2 };'
AT
AP