thanks for your reply, brian.

what's the definition of '*'?

is this pointer?

I've never heard about "pointer" IN RUBY.

Am I wrong?

2009. 01. 08,  8:06, Brian Candler ۼ:

> It does exactly what I'd expect. The insert line expands to:
>
> a.insert(2, 3, 4)  # a.length, b[0], b[1]
>
> and so it inserts 3 and 4 at the end of the array. (It inserts before
> element #n, but since a has only elements #0 and #1, asking to insert
> before element #2 is the same as asking to insert at the end of the
> list)
>
> irb(main):001:0> a = [1,2]
> => [1, 2]
> irb(main):002:0> b = [3,4]
> => [3, 4]
> irb(main):003:0> a.insert(a.length, *b)
> => [1, 2, 3, 4]
> irb(main):004:0> a
> => [1, 2, 3, 4]
>
> Of course, a += b is a simpler way to write this.
>
> Do you get something different? I am using ruby-1.8.6p114 under Ubuntu
> Hardy.
> -- 
> Posted via http://www.ruby-forum.com/.
>
>