是否可以,当OFFSET
在数组中但LENGTH
的结尾超过数组末尾时?
答案 0 :(得分:2)
易于尝试。
$ perl -wE'
my @a = "a".."e";
my @b = splice @a, 2, 10;
say 0+@b, " elements were removed.";
say 0+@a, " elements remain."
'
3 elements were removed.
2 elements remain.
我完全相信这不会改变。
答案 1 :(得分:1)
似乎有效。该文件说明了这种情况。以下代码说明了超出边界的长度是有效的。
@array = ('this','is','for','testing','this','is','for','testing');
@array1 = (1,2,3,4,5,6,7,8,9,10);
splice @array,5,100,@array1;
print join "\n", @array ;