3

拼接

可以吗,什么时候OFFSET在数组内,但结尾超过了数组LENGTH的结尾?

4

2 回答 2

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.

我完全相信这不会改变。

于 2012-05-11T17:47:53.403 回答
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 ;
于 2012-05-11T08:40:17.930 回答