Li Chen wrote:
> Hi all,
>
> I want to build a new array from an old one with every element being
> duplicated except the first and last element. And here are my codes. I
> wonder if this is a real Ruby way to do it.

>> array=[1,2,3,4,5,6,7,8,9,10]
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>> array.zip(array).flatten[1..-2]
=> [1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10]