From: Robert Klemme Date: 2007-11-21T16:00:02+09:00 Subject: Re: How to copy arrays? On 21.11.2007 07:58, Robert Klemme wrote: > On 21.11.2007 04:38, Martin Durai wrote: >> Thank you daniel, but my functionality is not return as a array. >> I need to copy a source array to a destination array. > > Maybe before we go off guessing you can show a bit more of your code. > While there are methods to copy and insert into another array, maybe > there is a more efficient solution. I meant to include this irb(main):007:0> a=(1..10).to_a => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] irb(main):008:0> a[2,4]=%w{a b c} => ["a", "b", "c"] irb(main):009:0> a => [1, 2, "a", "b", "c", 7, 8, 9, 10] irb(main):010:0> a.concat %w{foo bar} => [1, 2, "a", "b", "c", 7, 8, 9, 10, "foo", "bar"] irb(main):011:0> a => [1, 2, "a", "b", "c", 7, 8, 9, 10, "foo", "bar"] irb(main):012:0> robert