push (@array, @sublist);
-
splice (@array, 0, 1);
-
splice (@array, @array-1, 1);
-
splice (@array, scalar(@array), 0, @sublist);
-
splice (@array, 0, 0, @sublist);
push appends @sublist to the end of @array. splice(@array, scalar(@array), 0, @sublist) inserts @sublist at position equal to the array's length (the end), without removing any elements (0 elements removed).
push appends elements to the end of an array, which is exactly what splice(@array, scalar(@array), 0, @sublist) does: it starts the splice at the current length of the array (i.e., past the last element), removes zero elements, and inserts @sublist there. Starting the splice at index 0 would insert at the front instead, and using @array-1 as the offset would insert one position before the end, overwriting the last element's position rather than appending after it.